RANK.EQ

Updated on

RANK.EQ is a DAX function that returns the rank of a number in a column of numbers, assigning the top rank in case of ties.

Syntax

RANK.EQ(
   Value,
   ColumnName,
   Order
)
Argument Properties Description
Value The value to be ranked.
ColumnName A column in which the value will be ranked.
Order Optional The order to be applied. 0/FALSE/DESC – descending; 1/TRUE/ASC – ascending.

Return Values

A number indicating the rank of value among the numbers in columnName.

Remarks

  • columnName cannot refer to any column created using these functions: ADDCOLUMNS, ROW or SUMMARIZE.I

  • If value is not in columnName or value is a blank, then RANK.EQ returns a blank value.

  • Duplicate values of value receive the same rank value; the next rank value assigned will be the rank value plus the number of duplicate values. For example if five (5) values are tied with a rank of 11 then the next value will receive a rank of 16 (11 + 5).

  • This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.

Example 1

The following example creates a calculated column that ranks the values in SalesAmount_USD, from the InternetSales_USD table, against all numbers in the same column.

= RANK.EQ(InternetSales_USD[SalesAmount_USD], InternetSales_USD[SalesAmount_USD])

Example 2

The following example ranks a subset of values against a given sample. Assume that you have a table of local students with their performance in a specific national test and, also, you have the entire set of scores in that national test. The following calculated column will give you the national ranking for each of the local students.

= RANK.EQ(Students[Test_Score], NationalScores[Test_Score])

Other functions related to RANK.EQ are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/dax/rank-eq-function-dax

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy