This documentation is archived and is not being maintained.

Hierarchize (MDX)

Updated: 17 July 2006

Orders the members of a set in a hierarchy.

Hierarchize(Set_Expression [ , POST ] )


A valid Multidimensional Expressions (MDX) expression that returns a set.

The Hierarchize function organizes the members of specified set into hierarchical order. The function always retains duplicates.

  • If POST is not specified, the function sorts members in a level in their natural order. Their natural order is the default ordering of the members along the hierarchy when no other sort conditions are specified. Child members immediately follow their parent members.
  • If POST is specified, the Hierarchize function sorts the members in a level using a post-natural order. In other words, child members precede their parents.


The following example drills up on the Canada member. The Hierarchize function is used to organize the specified set members in hierarchical order, which is required by the DrillUpMember function.

SELECT DrillUpMember 
            ,[Geography].[Geography].[Country].[United States]
         ), {[Geography].[Geography].[Country].[United States]}
ON 0
FROM [Adventure Works]

The following example returns the sum of the Measures.[Order Quantity] member, aggregated over the first nine months of 2003 contained in the Date dimension, from the Adventure Works cube. The PeriodsToDate function defines the tuples in the set over which the Aggregate function operates. The Hierarchize function organizes the members of the specified set of members from the Product dimension in hierarchical order.

WITH MEMBER Measures.[Declining Reseller Sales] AS Count
            [Measures].[Reseller Sales Amount] < 
               ([Measures].[Reseller Sales Amount],[Date].Calendar.PrevMember)
MEMBER [Geography].[State-Province].x AS Aggregate 
( {[Geography].[State-Province].&[WA]&[US], 
   [Geography].[State-Province].&[OR]&[US] } 
         ({[Product].[All Products]})}
FROM [Adventure Works]
WHERE ([Geography].[State-Province].x, 
   [Date].[Calendar].[Calendar Quarter].&[2003]&[4],
   [Measures].[Declining Reseller Sales])

Release History

17 July 2006

Changed content:
  • Updated syntax and arguments to improve clarity.
  • Added updated examples.