MDX - 过滤测量值?

发布于 2024-11-30 02:53:41 字数 218 浏览 2 评论 0原文

我想编写一个在 WHERE 语句中使用度量值的 MDX 表达式。

例如:假设我想显示不同城市商店销售产品的收入,但我只想统计价格超过 10 美元的销售产品的收入。

这是我尝试过的方法,但不起作用:

WHERE ([MEASURES].[Price]>10)

How can I do this using MDX?

I want to write an MDX expression that uses a measure value in the WHERE statement.

For example: suppose I want to show the income from sold products in stores in different cities, but I only want to count the income for sold products that have a price over $10.

This is what I tried but it doesn't work:

WHERE ([MEASURES].[Price]>10)

How can I do this using MDX?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

妄司 2024-12-07 02:53:41

如果您有权访问olap db,您只需创建另一个指标价格(例如为DSV 上的事实表创建表达式并在此字段上创建指标)并将其用于进一步计算。
但是,如果您无权访问数据库,您可以尝试以下脚本:

WITH
MEMBER [Measures].[Price10] AS
    'IIF([Measures].[Price] < 10,0,[Measures].[Price])'
MEMBER [Measures].[COST] AS
    '[Measures].[Price10]*[Measures].[Unit Count]'
SELECT
    {[Measures].[COST]} ON COLUMNS,
    {[Customer].[Customer Geography].[City].Members,[Customer].[Customer Geography].[All Customers]} ON ROWS
from [Adventure Works]

这只是一个建议......它取决于用于计算指标价格的聚合类型。

If you have an access to olap db you can just create another metric Price (for example create expression for your fact table on DSV and create metric on this field) and use it for your further calculations.
But if you don't have an access to db, you can try following script:

WITH
MEMBER [Measures].[Price10] AS
    'IIF([Measures].[Price] < 10,0,[Measures].[Price])'
MEMBER [Measures].[COST] AS
    '[Measures].[Price10]*[Measures].[Unit Count]'
SELECT
    {[Measures].[COST]} ON COLUMNS,
    {[Customer].[Customer Geography].[City].Members,[Customer].[Customer Geography].[All Customers]} ON ROWS
from [Adventure Works]

It's just a suggestion... and it depends on aggregation type which uses for calculating metric Price.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文