Skip to main content

Rank

Determines the one-based rank of the specified tuple in the specified set by evaluating the specified numeric expression against the tuple.

Syntax

Rank(Tuple_Expression, Set_Expression, Numeric_Expression)

Input parameters

Tuple_Expression
A valid tuple expression, such as:

  • A standard tuple expression.
  • A tuple expression with static member references.
  • A function that returns a tuple.

Set_Expression
A valid set expression.

Numeric_Expression
A valid numeric expression. Will typically be a metric or calculation reference.

Notes

  • Rank does not reorder the set.

  • In the event of a tie, Rank assigns the same rank to tuples with duplicate values in the set. This assignment of the same rank to duplicate values affects the ranks of subsequent tuples in the set.

    For example, consider a set consisting of the following tuples: {(a,b), (e,f), (c,d)}. The tuple (a,b) has the same value as the tuple (c,d). If the tuple (a,b) has a rank of 1, then both (a,b) and (c,d) would have a rank of 1. However, the tuple (e,f) would have a rank of 3. There could be no tuple in this set with a rank of 2.

  • Multi-dimensional crossjoin set arguments are not supported.

Example

The following expression returns the rank of [Customer].[Customer Geography].currentMember in the set [Customer].[Customer Geography].[Customer Country].members, as determined by [Measures].[Internet Sales Amount Local]:

Rank(
[Customer].[Customer Geography].currentMember,
[Customer].[Customer Geography].[Customer Country].members,
[Measures].[Internet Sales Amount Local])