SSAS MDX Namedset issue with hierarchy

96 Views Asked by At

I'm using some MDX to create a named set in SSAS.

I have a hierarchy of Company, Group, Store

I'm trying to filter out a number of specific Store members.

I've used the Descendants function, as below, to do that, however it then doesn't have any proper hierarchy (expand and collapse etc) when viewing it in Performance Point. Any ideas? Is there a way of doing it without breaking the hierarchy?

Namedset:

Descendants([Company].[Company Hierarchy], [Company].[Company Hierarchy].
[Stores]) 
- [Company].[Company Hierarchy].[Stores].[Store1]  
- [Company].[Company Hierarchy].[Stores].[Store2] 
- [Company].[Company Hierarchy].[Stores].[Store3] 
2

There are 2 best solutions below

2
whytheq On

What you have looks ok. As an alternative maybe see if the following works:

EXCEPT(
  [Company].[Company Hierarchy].[Stores].MEMBERS
  ,{
     [Company].[Company Hierarchy].[Stores].[Store1]  
    ,[Company].[Company Hierarchy].[Stores].[Store2] 
    ,[Company].[Company Hierarchy].[Stores].[Store3] 
   }
)
0
SouravA On

Try using HIERARCHIZE around the set.

HIERARCHIZE
    (
    Descendants
            (
                [Company].[Company Hierarchy], 
                [Company].[Company Hierarchy].[Stores]  
            ) 
        - [Company].[Company Hierarchy].[Stores].[Store1]  
        - [Company].[Company Hierarchy].[Stores].[Store2] 
        - [Company].[Company Hierarchy].[Stores].[Store3] 
    )

msdn reference for hierarchize