Reputation: 337
Is it possible to sum an IIF statment in MDX?
Here's an example of what I am trying to do:
With
Member [dim something].[group].[Summed] as
Sum(
iif( [dim something].[date one] = [dim date].[specific date],1,0)
)
Select [dim something].[group].[summed] on 0,
[dim date].[specific date].members on 1
From [Cube]
I know this does not work, just trying to show what I am trying to do. I want to evaluate a condition and return a 1 or zero based on that condition. Then sum or count the number of times it was returned as 1
Fairly new to MDX, coming from a SQL background it's very different.
Upvotes: 1
Views: 2573
Reputation: 1755
IF [dim something].[date one]
is every only one date for your query then it would be something like the following
SELECT [Measures].[Some count] on 0
FROM [CUBE]
WHERE [dim date].[specific date]
Upvotes: 1
Reputation: 36136
its hard to know what you really want but there are mdx functions on SSAS to sum values based on dates.
The main one is YTD:
Sum(YTD([Dimension].[Calendar].CurrentMember),[Measures].[summed])
Upvotes: 0