Search code examples
ssasmdxssas-2008

Writing Case in MDX query?


I have an MDX code like this,

({[Ping].[ID].&[20] : [Ping].[ID].&[200]})
.
.

I have to write it with the use of Switch/Case statement.

This is what I done, but something is missing, not working.

WITH MEMBER [Ping].[ID].[FORMAT2] AS     
CASE     
WHEN [Ping].[ID].&[10]    
THEN [Ping].[ID].&[100]    
WHEN [Ping].[ID].&[20]     
THEN [Ping].[ID].&[200]    
ELSE [Ping].[ID].[FORMAT]    
END

Please help me.


Solution

  • WHEN [Ping].[ID].&[10] 
    

    is not a condition. The WHEN statements inside a case need to be a condition that evaluates to true or false.

    Something like

    WHEN [Ping].[ID].CurrentMember IS [Ping].[ID].&[10]
    

    or something similar.