Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Syntax
Table.AddRankColumn(table as table, newColumnName as text, comparisonCriteria as any, optional options as nullable record) as table
About
Appends a column named newColumnName
to the table
with the ranking of one or more other columns described by comparisonCriteria
. The RankKind
option in options
can be used by advanced users to pick a more-specific ranking method.
Example 1
Add a column named RevenueRank to the table which ranks the Revenue column from highest to lowest.
Usage
Table.AddRankColumn(
Table.FromRecords({
[CustomerID = 1, Name = "Bob", Revenue = 200],
[CustomerID = 2, Name = "Jim", Revenue = 100],
[CustomerID = 3, Name = "Paul", Revenue = 200],
[CustomerID = 4, Name = "Ringo", Revenue = 50]
}),
"RevenueRank",
{"Revenue", Order.Descending},
[RankKind = RankKind.Competition]
)
Output
Table.FromRecords({
[CustomerID = 1, Name = "Bob", Revenue = 200, RevenueRank = 1],
[CustomerID = 3, Name = "Paul", Revenue = 200, RevenueRank = 1],
[CustomerID = 2, Name = "Jim", Revenue = 100, RevenueRank = 3],
[CustomerID = 4, Name = "Ringo", Revenue = 50, RevenueRank = 4]
})