MDX - 多个Where和/或过滤条件

发布于 2024-12-27 17:45:46 字数 1543 浏览 2 评论 0原文

对于一个看似基本的 MDX 问题,我事先表示歉意。我正在尝试根据维度属性的多种组合来过滤 MDX 结果集。

这是我的维度/度量布局:

维度:

[AccidentDate]
Year
Quarter
Month
Day
Date

[ItemInformation] 
ItemState

[CoverageInformation] 
CoverageHiearchy
----UserLine
--- Coverage Code

度量:

CTDPaid

现在,我希望从 [CTDPaid] 度量中选择总金额,并按 [ItemInformation].ItemState 分组属性。但是,我想根据多个过滤条件来过滤此查询的结果集。

这些条件将如下所示,并且将单独进行评估:

1. [CoverageInformation].[CoverageHiearchy].&[98]&[002] and [ItemInformation].ItemState.&[MI]
2. [CoverageInformation].[CoverageHiearchy].&[98]&[004] and [ItemInformation].ItemState.&[MI]
3. [CoverageInformation].[CoverageHiearchy].&[98]&[004] and [ItemInformation].ItemState.&[IL]
4. [CoverageInformation].[CoverageHiearchy].&[98]&[002] and [ItemInformation].ItemState.&[IL]

本质上,如果我将其移植到 T-SQL where 条件,它将构成以下内容:

where

  (ItemState = 'MI' and CoverageCode = '002' and UserLine = '98')

and

  (ItemState = 'MI' and CoverageCode = '004' and UserLine = '98')

and

  (ItemState = 'IL' and CoverageCode = '002' and UserLine = '98')

and

  (ItemState = 'IL' and CoverageCode = '004' and UserLine = '98')

将其放入MDX 切片器无法运行,因为我认为不支持跨同一层次结构的交叉连接。

使用 filter() MDX 函数对我来说也不起作用。

我非常感谢您帮助制定正确的 MDX 查询,以正确过滤我的结果集,如上所述。

非常感谢您抽出时间

I apologize beforehand for a seemingly basic MDX question. I am trying to filter an MDX resultset based on multiple combinations of dimension attributes.

This is my dimension/measures layout:

Dimensions:

[AccidentDate]
Year
Quarter
Month
Day
Date

[ItemInformation] 
ItemState

[CoverageInformation] 
CoverageHiearchy
----UserLine
--- Coverage Code

Measures:

CTDPaid

Now, I wish to select the total amount from the [CTDPaid] measure, grouped by the [ItemInformation].ItemState attribute. However, I would like to filter the resultset of this query based on multiple filter conditions.

These conditions would be the following, and would be evaluated separately:

1. [CoverageInformation].[CoverageHiearchy].&[98]&[002] and [ItemInformation].ItemState.&[MI]
2. [CoverageInformation].[CoverageHiearchy].&[98]&[004] and [ItemInformation].ItemState.&[MI]
3. [CoverageInformation].[CoverageHiearchy].&[98]&[004] and [ItemInformation].ItemState.&[IL]
4. [CoverageInformation].[CoverageHiearchy].&[98]&[002] and [ItemInformation].ItemState.&[IL]

Essentially, if I were to port this over to a T-SQL where condition, it would constitute the following:

where

  (ItemState = 'MI' and CoverageCode = '002' and UserLine = '98')

and

  (ItemState = 'MI' and CoverageCode = '004' and UserLine = '98')

and

  (ItemState = 'IL' and CoverageCode = '002' and UserLine = '98')

and

  (ItemState = 'IL' and CoverageCode = '004' and UserLine = '98')

Putting this into an MDX slicer would not function as I believe cross joins across the same hierarchy are not supported.

Using the filter() MDX function is not working for me either.

I would greatly appreciate assistance with formulating the correct MDX query to correctly filter my resultset as outlined above.

Thank you kindly for your time

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

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

发布评论

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

评论(1

旧伤还要旧人安 2025-01-03 17:45:46

尝试这个解决方案:

SELECT 
     {...} On Columns,
     {...} On Rows
FROM  (Select 
{([CoverageInformation].[CoverageHiearchy].&[98]&[002], [ItemInformation].ItemState.&[MI]),
 ([CoverageInformation].[CoverageHiearchy].&[98]&[004], [ItemInformation].ItemState.&[MI])
 ([CoverageInformation].[CoverageHiearchy].&[98]&[004], [ItemInformation].ItemState.&[IL])
 ([CoverageInformation].[CoverageHiearchy].&[98]&[002], [ItemInformation].ItemState.&[IL])} On Columns
From [CubeName])

Try this solution:

SELECT 
     {...} On Columns,
     {...} On Rows
FROM  (Select 
{([CoverageInformation].[CoverageHiearchy].&[98]&[002], [ItemInformation].ItemState.&[MI]),
 ([CoverageInformation].[CoverageHiearchy].&[98]&[004], [ItemInformation].ItemState.&[MI])
 ([CoverageInformation].[CoverageHiearchy].&[98]&[004], [ItemInformation].ItemState.&[IL])
 ([CoverageInformation].[CoverageHiearchy].&[98]&[002], [ItemInformation].ItemState.&[IL])} On Columns
From [CubeName])
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文