简体   繁体   中英

How to use multi level hierarchy names in MDX query

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

Am having the below hierarchies/data in my cube:

在此处输入图像描述

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: 在此处输入图像描述

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

Please find the query and its result

在此处输入图像描述

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

在此处输入图像描述

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

Can anyone please guide me to get the required value?

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM