简体   繁体   中英

calculated measure and filter by two different dimensions

this works

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

However, adding another dimension like this

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 

caused this error,

Executing the query ... Members, tuples or sets must use the same hierarchies in the function. Execution complete

how can I rewrite the second query to have two dimensions. BTW, it's for a cube Calculation,so I'm only going to use something like this

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

Update: Solution

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

Try this, might work..

SUM
(
-{
[Dim Event].[Ticket].&[Open]
},
{
[Dim Category].[Status].&[OPEN]
},
(
[Measures].[Event Incidents Count]
)
)
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

Hop this help !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM