Table.AddRankColumn
Syntax
Table.AddRankColumn(table as table, newColumnName as text, comparisonCriteria as any, optional options as nullable record) as table
Informácie
Pripojí stĺpec s názvom newColumnName
k tabuľke table
so poradím jedného alebo viacerých ďalších stĺpcov popísaných v téme comparisonCriteria
. Možnosť RankKind
in options
môžu použiť pokročilí používatelia na výber špecifickejšej metódy hodnotenia.
Príklad č. 1
Pridajte do tabuľky stĺpec s názvom RevenueRank (Výnos), ktorý určuje poradie stĺpca Revenue (Výnos) od najvyššej po najnižšiu.
Použitie
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]
)
Výkon
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]
})