0
votes

Using Mondrian, I would like to get Level in MDX query for each axis.

For example :

SELECT NON EMPTY {Hierarchize({[Product].[Product Family].Members})} ON COLUMNS

NON EMPTY CrossJoin([Time].[Quarter].Members, [Store].[Store Name].Members) ON ROWS

FROM [Sales]

WHERE {Hierarchize({[Measures].[Unit Sales]})}

Expected results are :

COLUMNS : [Product].[Product Family]

ROWS : [Time].[Quarter], [Store].[Store Name]

Recently I used this code :

axes[i].getSet().getType().getLevel()

It worked for the COLUMNS axis, but it doesn't work for the ROWS axis. I suppose this is caused by the arity in ROWS axis which is more than 1.

Is there any way to get the level in an axis which has arity more than 1 ?

Thanks.

1

1 Answers

0
votes

How about this:

with
member [Product].[Product Family].[Row current member] as
[Time].[Quarter].currentmember.name + ', ' +
[Store].[Store Name].currentmember.name

then in select clause include the member in column axis:

SELECT NON EMPTY Hierarchize({[Product].[Product Family].Members,
                 [Product].[Product Family].[Row current member]}) ON COLUMNS

NON EMPTY CrossJoin([Time].[Quarter].Members, [Store].[Store Name].Members) ON ROWS

FROM [Sales]

WHERE {Hierarchize({[Measures].[Unit Sales]})}