通过两个不同的维度计算测量和过滤

时间:2013-08-08 21:55:31

标签: filtering mdx dimension measure

这是有效的

WITH MEMBER [Measures].[Pre] AS
SUM
(
-{
[Dim Event].[Ticket].&[Open]
},
(
[Measures].[Event Incidents Count]
)
)
Select  [Measures].[Pre] on 0
From Event 

但是,添加其他维度

WITH MEMBER [Measures].[Pre] AS
SUM
(
-{
[Dim Event].[Ticket].&[Open]
,[Dim Category].[Status].&[OPEN]
},
(
[Measures].[Event Incidents Count]
)
)

Select  [Measures].[Pre] on 0
From Event 

导致此错误,

执行查询... 成员,元组或集必须在函数中使用相同的层次结构。 执行完成

如何重写第二个查询以获得两个维度。 顺便说一句,这是一个立方体计算,所以我只会使用这样的东西

SUM
(
-{
[Dim Event].[Ticket].&[Open]
,[Dim Category].[Status].&[OPEN]
},
(
[Measures].[Event Incidents Count]
)
)

更新:解决方案

WITH MEMBER [Measures].[Pre] AS
SUM
(
CROSSJOIN(
- {
[Dim Event].[Ticket].&[Open] }
, - { [Dim Category].[Status].&[OPEN] }
)
,
[Measures].[Event Incidents Count]
)

2 个答案:

答案 0 :(得分:0)

试试这个,可能有用......

SUM
(
-{
[Dim Event].[Ticket].&[Open]
},
{
[Dim Category].[Status].&[OPEN]
},
(
[Measures].[Event Incidents Count]
)
)

答案 1 :(得分:0)

WITH MEMBER [Measures].[Pre] AS
SUM
([Dim Event].[Ticket].&[Open] * [Dim Category].[Status].&[OPEN],
([Measures].[Event Incidents Count])
)

Select  [Measures].[Pre] on 0
From Event

跳这个帮助!