Power QueryExercises

Table.SelectRows

Table function · By Tahir Nas · Examples run in our simulator · Published · Updated

Keeps the rows for which a condition is true.

When to use it

Use it whenever rows should be kept or dropped by a rule: valid statuses, a date range, non-blank keys. The rule runs on every refresh, so new rows are filtered the same way. To keep rows whose value is in a list, combine it with List.Contains rather than chaining or conditions.

Syntax

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

Parameters

table
The table to filter.
condition
A function of the row, usually written with each, returning true to keep the row.

Returns

A table with the same columns and only the matching rows.

Example

Table.SelectRows(#table({"Region", "Product", "Qty"}, {{"North", "Kite", 2}, {"South", "Reel", 5}, {"North", "Reel", 1}, {"West", "Kite", 4}}), each [Qty] >= 2)

Result

RegionProductQty
NorthKite2
SouthReel5
WestKite4

Example: keep rows for several values

List.Contains turns a list of allowed values into one condition, which stays readable as the list grows.

Table.SelectRows(#table({"Region", "Rep", "Amount"}, {{"North", "Ana", 120}, {"South", "Bo", 80}, {"North", "Cy", 200}, {"South", "Ana", 50}}), each List.Contains({"Ana", "Cy"}, [Rep]))

Result

RegionRepAmount
NorthAna120
NorthCy200
SouthAna50

Both results are produced by the Power Query Exercises simulator, an independent implementation of a documented subset of M, and checked on every build.

Good to know

Common mistakes

The matching command in Excel

Excel for Windows
Column header filter arrow > Text Filters, Number Filters or Date Filters
What you see
Each filter you apply in the menu or the Filter Rows dialog is recorded as a filtering step.

Paths are for the Power Query editor in Excel for Microsoft 365, checked against Microsoft's documentation on 8 November 2026: Filter by values in a column (Microsoft Learn).

Exercises that use Table.SelectRows

Learn more

Related functions

Official documentation: Table.SelectRows on Microsoft Learn.