Table.SelectRowsWithErrors
Keeps only the rows that have an error in a cell: in any column, or in the columns you name.
Group: Table. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Table.SelectRowsWithErrors(table as table, optional columns as nullable list) as table
| Parameter | Type | Description |
|---|---|---|
table | table | The table to check. |
columns | nullable list optional | The columns to check; every column when left out. |
Returns
table. The rows with at least one error in a checked cell, errors and all.
Remarks
- Handy for finding what went wrong: look at the other columns of these rows, or at the errors with
try.
Examples
Which products failed
The result's rows still hold their errors, so the example shows their products.
let
Typed = Table.TransformColumnTypes(#table({"Product", "Price"}, {{"Chair", "50"}, {"Desk", "n/a"}}), {{"Price", type number}})
in
Table.SelectRowsWithErrors(Typed)[Product]
{"Desk"}
Errors in one column only
let
Typed = Table.TransformColumnTypes(
#table({"Product", "Price", "Units"}, {{"Chair", "50", "x"}, {"Desk", "n/a", "2"}, {"Lamp", "30", "1"}}),
{{"Price", type number}, {"Units", Int64.Type}})
in
Table.SelectRowsWithErrors(Typed, {"Price"})[Product]
{"Desk"}
Chair has an error too, in Units, which wasn't checked.
Related functions
Table.RemoveRowsWithErrors, Table.ReplaceErrorValues, Table.TransformColumnTypes.