RankKind.Competition

Updated on

RankKind.Competition (0) is an enumeration that specifies the type of ranking. It is a member of the RankKind.Type and indicates that items which compare as equal receive the same ranking number and then a gap is left before the next ranking. This ranking method does not guarantee a ranking with consecutive numbers and a rank can appear multiple times.

Examples

Imagine you have a dataset called Source with the following setup:

Source table as dataset for RankKind.Type

You can rank this data using the Table.AddRankColumn function. Below examples rank the data based on the revenue amount.

= Table.AddRankColumn( 
    Source,
    "Revenue Asc",
    { "Revenue", Order.Ascending },   // Sort column in Ascending order
    [RankKind = RankKind.Competition]
 )

= Table.AddRankColumn( 
    Source,
    "Revenue Desc",
    { "Revenue", Order.Descending },  // Sort column in Descending order
    [RankKind = RankKind.Competition]
 )
Using Table.AddRankColumn with Ascending and Descending Order

To make this ranking unique, you can provide provide multiple columns in the comparison criteria. Alternatively you can make use of RankKind.Ordinal.

= Table.AddRankColumn( 
    Source,
    "Revenue Asc",
    { { "Revenue", Order.Descending }, {"CustomerID", Order.Ascending } },
    [RankKind = RankKind.Competition]
 )

= Table.AddRankColumn( 
    Source,
    "Revenue Desc",
    { { "Revenue", Order.Descending }, {"CustomerID", Order.Ascending } },
    [RankKind = RankKind.Competition]
 )
Using Table.AddRankColumn with Multiple Sort by Columns

Other related enumerations are:

Applies to

Here’s a list of functions that work with RankKind.Type:

Contribute » | Contributors: Rick de Groot