OpenBI Docs Buy

Table.SelectRows

Keeps the rows for which a condition is true.

Group: Table. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Table.SelectRows(table as table, condition as function) as table
ParameterTypeDescription
tabletableThe table to filter.
conditionfunctionA function of a row, usually written each ..., that gives true for a row to keep.

Returns

table. The rows that passed, in their order, with all of the columns.

Remarks

  • A comparison with null gives null, and null doesn't keep a row: each [Price] > 40 drops the rows without a price. Test for them with [Price] = null.
  • A condition that gives anything but true, false or null is an error.
  • Filtering a column in Transform data writes this step.

Examples

Products over 40

Table.SelectRows(#table({"Product", "Price"}, {{"Chair", 50}, {"Desk", null}, {"Lamp", 130}}), each [Price] > 40)
ProductPrice
Chair50
Lamp130

The desk has no price, so it isn't over 40.

Two conditions

let
    Sales = #table({"Shop", "Product", "Sales"}, {{"Oslo", "Chair", 120}, {"Bergen", "Desk", 340}, {"Oslo", "Lamp", 40}})
in
    Table.SelectRows(Sales, each [Shop] = "Oslo" and [Sales] >= 100)
ShopProductSales
OsloChair120

The orders of one month

let
    Orders = #table({"Order", "Date"}, {{1, #date(2026, 1, 30)}, {2, #date(2026, 2, 3)}, {3, #date(2026, 2, 27)}, {4, #date(2026, 3, 1)}})
in
    Table.SelectRows(Orders, each [Date] >= #date(2026, 2, 1) and [Date] < #date(2026, 3, 1))
OrderDate
22026-02-03
32026-02-27

Table.SelectRowsWithErrors, Table.RemoveMatchingRows, Table.FindText, Table.MatchesAllRows.

Last updated · OpenBI Studio 0.3.79