次の方法で共有


Table.AddRankColumn

構文

Table.AddRankColumn(
    table as table,
    newColumnName as text,
    comparisonCriteria as any,
    optional options as nullable record
) as table

詳細

newColumnName によって説明される 1 つまたは複数の他の列のランキングが含まれる table に、comparisonCriteria という名前の列が追加されます。 optionsの RankKind オプションは、上級ユーザーがより具体的なランク付け方法を選択するために使用できます。

"RevenueRank" という名前の列をテーブルに追加します。このテーブルでは、"Revenue" 列が最高から最下位にランク付けされます。

使用方法

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]
)

出力

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]
})

比較基準