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
| Parameter | Type | Description |
|---|---|---|
table | table | The table to filter. |
condition | function | A 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] > 40drops 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)
| Product | Price |
|---|---|
| Chair | 50 |
| Lamp | 130 |
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)
| Shop | Product | Sales |
|---|---|---|
| Oslo | Chair | 120 |
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))
| Order | Date |
|---|---|
| 2 | 2026-02-03 |
| 3 | 2026-02-27 |
Related functions
Table.SelectRowsWithErrors, Table.RemoveMatchingRows, Table.FindText, Table.MatchesAllRows.