Table.TransformRows
A list made by a function of each row: one value per row, in the table's order.
Group: Table. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Table.TransformRows(table as table, transform as function) as list
| Parameter | Type | Description |
|---|---|---|
table | table | The table whose rows to go through. |
transform | function | A function of a row (a record) that gives the list's value for that row. |
Returns
list. A value per row.
Remarks
- The result is a list, not a table: give records and wrap the list in
Table.FromRecordsto get a table back.
Examples
A line of text per product
Table.TransformRows(#table({"Product", "Price"}, {{"Chair", 50}, {"Desk", 120}}), each [Product] & ": " & Text.From([Price]))
{"Chair: 50", "Desk: 120"}
Back to a table
Table.FromRecords(Table.TransformRows(#table({"Product", "Price"}, {{"Chair", 50}, {"Desk", 120}}), each [Product = [Product], WithVat = [Price] * 1.25]))
| Product | WithVat |
|---|---|
| Chair | 62.5 |
| Desk | 150 |
Related functions
Table.ToList, Table.AddColumn, List.Transform, Table.FromRecords.