Table.SelectRows

構文

Table.SelectRows(table as table, condition as function) as table

バージョン情報

選択 condition と一致する行のテーブルを table から返します。

例 1

[CustomerID] 列の値が 2 より大きい行をテーブルで選択します。

Table.SelectRows(
    Table.FromRecords({
        [CustomerID = 1, Name = "Bob", Phone = "123-4567"],
        [CustomerID = 2, Name = "Jim", Phone = "987-6543"],
        [CustomerID = 3, Name = "Paul", Phone = "543-7890"],
        [CustomerID = 4, Name = "Ringo", Phone = "232-1550"]
    }),
    each [CustomerID] > 2
)
CustomerID 名前 Phone
3 Paul 543-7890
4 Ringo 232-1550

例 2

名前に "B" が含まれない行をテーブルで選択します。

Table.SelectRows(
    Table.FromRecords({
        [CustomerID = 1, Name = "Bob", Phone = "123-4567"],
        [CustomerID = 2, Name = "Jim", Phone = "987-6543"],
        [CustomerID = 3, Name = "Paul", Phone = "543-7890"],
        [CustomerID = 4, Name = "Ringo", Phone = "232-1550"]
    }),
    each not Text.Contains([Name], "B")
)
CustomerID 名前 Phone
2 Jim 987-6543
3 Paul 543-7890
4 Ringo 232-1550