OpenBI Docs Buy

Table.SelectMatchingRows

Keeps only the rows equal to one of the rows you list.

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

Syntax

Table.SelectMatchingRows(table as table, rows as list, optional equationCriteria as any) as table
ParameterTypeDescription
tabletableThe table to take rows from.
rowslistThe rows to keep, each as a record.
equationCriteriaany
optional
The columns that decide a match, as a name or a list of names.

Returns

table. The matching rows, in the table's order.

Remarks

Compared with Power Query

Microsoft's Power Query M reference doesn't list Table.SelectMatchingRows. For a query that must also run in Power BI Desktop, write the filter with Table.SelectRows, such as Table.SelectRows(Stock, each List.Contains({"Oslo"}, [Shop])).

Examples

The rows of one shop

Table.SelectMatchingRows(#table({"Shop", "Product"}, {{"Oslo", "Chair"}, {"Bergen", "Desk"}, {"Oslo", "Desk"}}), {[Shop = "Oslo"]}, "Shop")
ShopProduct
OsloChair
OsloDesk

Two whole rows

Table.SelectMatchingRows(#table({"Shop", "Product"}, {{"Oslo", "Chair"}, {"Bergen", "Desk"}, {"Oslo", "Desk"}}), {[Shop = "Oslo", Product = "Chair"], [Shop = "Bergen", Product = "Desk"]})
ShopProduct
OsloChair
BergenDesk

Table.RemoveMatchingRows, Table.SelectRows, Table.Contains.

Last updated · OpenBI Studio 0.3.79