What is the best way to list a member and all of his descendants in MDX?

In the OLAP database, I work with the "Location" hierarchy, which consists of the levels Company, Region, Area, Site, Room, Till. For a specific company, I need to write several MDXs that list all regions, areas and sites (but not all levels below the Site). I am currently achieving this with the following MDX

HIERARCHIZE({
[Location].[Test Company], 
Descendants([Location].[Test Company], [Location].[Region]), 
Descendants([Location].[Test Company], [Location].[Area]), 
Descendants([Location].[Test Company], [Location].[Site])
})

Since my knowledge of MDX is limited, I was wondering if there is an easier way to do this, with one command and not four? Is there a less sure way to achieve this, or is my example the only real way to achieve this?

+3
source share
2 answers
DESCENDANTS([Location].[Test Company],[Location].[Site], SELF_AND_BEFORE)
+5
source

, , - DESCENDANTS. " ", , , .

"" ( ) , 3 .

, , SELF_AND_AFTER, . http://msdn.microsoft.com/en-us/library/ms146075.aspx

- oops, santiiiii, SELF_AND_BEFORE

+2

Source: https://habr.com/ru/post/1697656/


All Articles