Search code examples
mdxolapcube

Adding together cube measures with different where clauses


I Have two MDX queries,

select [Measures].[Goals A] on 0 from [FDC Star] where [Squad A].[Squad Key]

And

select [Measures].[Goals B] on 0 from [FDC Star] where [Squad B].[Squad Key]

I would like to add the two values together but being very new to MDX I have no idea.


Solution

  • You can use calculated members:

    WITH
       MEMBER [Measures].[A] AS ([Measures].[Goals A], [Squad A].[Squad Key])
       MEMBER [Measures].[B] AS ([Measures].[Goals B], [Squad B].[Squad Key])
    SELECT {[Measures].[A], [Measures].[B]} ON 0
    FROM [FDC Star]