setmdxdescendant

MDX Get Descendants of Named Set


I'm looking to return all leaf descendants of a named set in MDX.

The set contains the following members:

CREATE SET [Time].[Quarter].[ActiveBudget_Qtr] AS 
   '{[Time].[Default].&[2020Q3], [Time].[Default].&[2020Q4], 
     [Time].[Default].&[2021Q1], [Time].[Default].&[2021Q2]}'

I am trying to return the month (which are leaf) descendants of this set:

DESCENDANTS({[Time].[Default].[ActiveBudget_Qtr]}, , LEAVES)

However, this is not returning any members. Thoughts?


Solution

  • A little bit convoluted but something like the following:

    DESCENDANTS(
      INTERSECT( 
        [Time].[Quarter].[Quarter].MEMBERS
       ,[Time].[Quarter].[ActiveBudget_Qtr]
      )
    ,, LEAVES
    )