How to use multi level hierarchy names in MDX query

378 views Asked by At

I need to use the dimension field under the 2 hierarchies i.e., one hierarchy under another hierarchy in the MDX query.

Am having the below hierarchies/data in my cube:

enter image description here

I need to use the highlighted [Country] field in the MDX query.

Please find the query I have tried.

WITH MEMBER [Measures].[Expression1] AS [Geography].[Geography].[Country].currentmember.membervalue
select [Measures].[Expression1] on Columns from [Adventure Works]

Am getting below error: enter image description here

But when am using the same syntax for a single hierarchy it works.

Please find the query and its result

enter image description here

WITH MEMBER 
[Measures].[Expression1] AS [Geography].[Country].currentmember.membervalue
select [Measures].[Expression1] on Columns from [Adventure Works]

enter image description here

Am expecting the same result using the two hierarchy names of the field.

Can anyone please guide me to get the required value?

1

There are 1 answers

0
Magnus Smith On

I don't think you need WITH or currentmember or membervalue` at all.

These two queries ought to list you the items within each hierarchy's level...

select {[Geography].[Country].members} on Columns from [Adventure Works]

select {[Geography].[Geography].[Country].members} on Columns from [Adventure Works]