The functions in this class are:

ReverseSet(Set)

This function reverses the order of the set passed in as a parameter. For instance:

ASSP.ReverseSet([Date](Date).[Calendar](Calendar).[Calendar Year](Calendar-Year).members)

returns 2004, 2003, 2002, 2001.

RandomSample(Set, NumberToReturn)

This function takes in a set as the first parameter and an integer as the second parameter. It returns NumberToReturn random tuples from the Set. For instance:

ASSP.RandomSample([Product].[Product].[Product].members, 10)

returns 10 random products.

InverseHierarchility(Set)

This function reverses the order of the members within each tuple in the set. The order of the set does not change. For instance:

ASSP.InverseHierarchility({([2004],[Bikes]),([2003],[Accessories]})

returns:

{([Bikes],[2004]),([Accessories],[2003])}

AsymmetricDrillDown(Set, TupleIndex, HierarchyIndex)

This function expands the set which is passed in as the first parameter. For the tuple at position TupleIndex and for the member at HierarchyIndex, add tuples to the set by drilling down that member. Indexes are zero based.

Order(Set, Expression, [SortDescending] )

This function is very similar to the built-in Order function in MDX. In some cases, it may outperform the built-in Order function due to a bug. However, because it does the sorting in memory, it may also not scale as well as the built-in MDX Order function, so please test carefully. The parameters are as follows:

  • Set - The first parameter is a set expression that you wish to sort.
  • Expression - The second parameter is the expression you wish to sort on. This expression is evaluated for every tuple in the set you passed in as the first parameter. Then the evaluated value is cast to a double and sorted. (Do not use an expression that could return a string because it will either cause an error during casting to a double, or it will sort as a number, not as a string. This limitation exists because it is not possible to detect the type of an evaluated expression.)
  • SortDescending - The third parameter is an optional boolean parameter which specifies sort direction. Passing in false means to sort BASC. Passing in true means to sort BDESC. Sorting ASC or DESC are not supported by the ASSP Order function. Note that the ordering may not match the order of the built-in Order function for those tuples that tie.

Note this function must be called with brackets so as not to conflict with the built-in Order function:

ASSP.[Order]([Product].[Category].[Category].MEMBERS, [Measures].[Internet Sales Amount], true)

TopCountWithTies(Set, Count, SortExpression) BottomCountWithTies(Set, Count, SortExpression)

This function behaves exactly like the native MDX function TopCount and BottomCount. The only difference is the function will return the tied up value if the Nth tuple has the duplicated value. Thanks to Jean Zhang for the first prototype of this code.

ASSP.TopCountWithTies(
 [Product].[Product Categories].[Product].members
 ,62
 ,[Measures].[Internet Order Count]
)