简体   繁体   中英

MDX ALL Level of every attribute in a dimension

I am trying to create a measure in my cube, SSAS 2008 R2.

I have a Product dimension with 10 attributes and 5 hierarchies, which I don't think is unusual.

Product
-Size
-Exclusive To
-PriceCode
-Category
-Range
etc...

I have a measure CustomerCount that I wish to see for the ALL level across "Product" as a total. I also have other dimensions with multiple attributes and hierarchies, where I wish to maintain the user selections, so for example Country "USA", Account Type "National", Month "May 2012" etc...

I currently have

Measures.TotCustomerCount = ([Measures].[CustomerCount],[Product].[Size].[All],[Product].[Exclusive To].[All],[Product].[PriceCode].[All],[Product].[Category].[All],[Product].[Range].[All],... )

This works... however it's laborious, and if any new attributes are created or indeed removed I need to update this statement. Surely there is a better way.

Is there something that will allow

Measures.TotCustomerCount = ([Measures].[CustomerCount],[Product].TopLevels? )

Thanks

You should be able to only include the key attribute and .AllMembers here, so something like:

Measures.TotCustomerCount = (Measures.CustomerCount,Product.Product.AllMembers) where Product is the Attribute (Lowest Level) for the Product dimension.

Root(Dimension)将为您提供每个属性的All成员(或默认成员)

Measures.TotCustomerCount = ([Measures].[CustomerCount],Root([Product]))

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