Table.AddRankColumn
Sintaxis
Table.AddRankColumn(table as table, newColumnName as text, comparisonCriteria as any, optional options as nullable record) as table
Acerca de
Anexa una columna denominada newColumnName
a table
con la clasificación de una o varias columnas descritas por comparisonCriteria
. Los usuarios avanzados pueden usar la opción RankKind
de options
para elegir un método de clasificación más específico.
Ejemplo 1
Agregue una columna denominada RevenueRank a la tabla que clasifica la columna Revenue (Ingresos) de mayor a menor.
Uso
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]
)
Salida
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]
})