Getting parents of a set (MDX)

  • I have a time range, for instance {[Time].[Fiscal - Month].[2006].[July]:[Time].[Fiscal - Month].[2007].[December]}. In theory, I guess this could be any set.

    I want to get a hierarchical structure of this set and its parents, something along the lines of:

    2006

    July

    August...

    2007

    July

    August...

    2008

    July...

    December

    I've tried using DESCENDANTS(mySet, 0, SELF_AND_BEFORE) but this doesn't work. How can I achieve this?

  • Not an MDX guy, but does this help?

    http://www.databasejournal.com/features/mssql/article.php/10894_2168911_3

  • Thanks Steve,

    Unfortunately the use of the Parent function there refers to a member as opposed to a set. That is, it will only show the parent for a single tuple. I have a range of tuples (a set) and I want to get all the parents relative to this set.

    Thanks for the suggestion,

    Sam

  • You'll need to check the results, but try:

    HIERARCHIZE

    ( GENERATE( {[Time].[Fiscal - Month].[2006].[July]:[Time].[Fiscal - Month].[2007].[December]}, ASCENDANTS( [Time].[Fiscal - Month].CurrentMember ) ) )

  • That's done it, thanks Dave!

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply