Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MDX Not equal basic question

Tags:

ssas

mdx

I'm a BI starter with SSAS and SSRS and I have a very basic question of MDX.

It is very easy to get all values that match a condition in a calculated member. For example

WITH MEMBER [MEASURES].TOTAL_DOT_TEST
 AS
(
[Dim Transportation Incident Dot Classification].[Dim Transportation Incident Dot     Classification].&[3],
[Measures].[Fact Transportation Incident Count] 
)

will get the number of transportation incidents that have a classification value of 3.

However, using this example, how do I get the number of transportation incidents that does not have an ID of 3?

Something like select * from table where classification <> 3

Thanks

like image 946
Daniel Avatar asked Mar 20 '26 13:03

Daniel


1 Answers

You can use Aggregate() and Except() as following :

WITH MEMBER [MEASURES].TOTAL_DOT_TEST
 AS Aggregate (   
      Except( 
        [Dim Transportation Incident Dot Classification].[Dim Transportation Incident Dot     Classification].members ,
        { [Dim Transportation Incident Dot Classification].[Dim Transportation Incident Dot     Classification].&[3] }
      ),
      [Measures].[Fact Transportation Incident Count] 
)
like image 160
Marc Polizzi Avatar answered Mar 24 '26 21:03

Marc Polizzi