user2210516
user2210516

Reputation: 683

Union in MDX query

In my time dimensions i have 2013,2014,2015.

How can i make a Union in this mdx so i get the results from this mdx for all thoose years and not only for 2014 like in the example..

    select NON EMPTY {[Measures].[Absatz Plan], [Measures].[Umsatz Plan], [Measures].[Absatz Effektiv], [Measures].[Umsatz Effektiv]} ON COLUMNS,
  NON EMPTY Crossjoin(Hierarchize({([Time].[2014], [Artikel].[All Artikels], [Markt].[All Markts])}), {[Version].[14], [Version].[16], [Version].[18]}) ON ROWS
from [Budget]

Upvotes: 1

Views: 424

Answers (1)

FrankPl
FrankPl

Reputation: 13315

Just apply CrossJoin twice:

select NON EMPTY
       {[Measures].[Absatz Plan], [Measures].[Umsatz Plan], [Measures].[Absatz Effektiv], [Measures].[Umsatz Effektiv]}
       ON COLUMNS,

       NON EMPTY
       CrossJoin(
          Crossjoin(
            {[Time].[2013], [Time].[2014], [Time].[2015]},
            {([Artikel].[All Artikels], [Markt].[All Markts])}
          ),
          {[Version].[14], [Version].[16], [Version].[18]}
       )
       ON ROWS
from [Budget]

I removed the Hierarchize, as I think it is not necessary in this context. It would order its argument by the order defined for the hierarchy in the cube. If the order of the result seems wrong, you could re-add it.

Upvotes: 2

Related Questions