Returns the one-based rank of a specified tuple in a specified set.

Syntax

Rank(Tuple_Expression, Set_Expression [ ,Numeric Expression ] )
CODE

Arguments

Tuple_Expression

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

Set_ExpressionA valid Multidimensional Expressions (MDX) expression that returns a set.
Numeric_ExpressionA valid numeric expression that is typically a Multidimensional Expressions (MDX) expression of cell coordinates that return a number.

Examples

In the example below gives a number from 24 to 0 starting from the current date's month descending until 24 months ago. All the rest members give value 0. 

Rank(
  [Time].CurrentHierarchyMember,
  Filter(
    [Time].CurrentHierarchyMember.Level.Members,
    DateBetween(
      [Time].CurrentHierarchyMember.StartDate,
      '24 months ago','today'
         )
    )
)
CODE

See also