Table.ToList
One value per row: each row's values made into one by a function you give.
Group: Table. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Table.ToList(table as table, optional combiner as nullable function) as list
| Parameter | Type | Description |
|---|---|---|
table | table | The table to turn into a list. |
combiner | nullable function optional | A function of a row's values (a list) that gives one value; when left out, the values are joined with commas, and they must be text. |
Returns
list. A value per row, in the table's order.
Remarks
- The function gets each row as a list of its values in column order, not as a record:
_{0}is the first column's value,_{1}the second's.
Examples
Shop and product in one text
Table.ToList(#table({"Shop", "Product"}, {{"Oslo", "Chair"}, {"Bergen", "Desk"}}), Combiner.CombineTextByDelimiter(" - "))
{"Oslo - Chair", "Bergen - Desk"}
Commas when no function is given
Table.ToList(#table({"Shop", "Product"}, {{"Oslo", "Chair"}, {"Bergen", "Desk"}}))
{"Oslo,Chair", "Bergen,Desk"}
A function of the row's values
Table.ToList(#table({"Product", "Units"}, {{"Chair", 4}, {"Desk", 1}}), each Text.From(_{1}) & " x " & _{0})
{"4 x Chair", "1 x Desk"}
Related functions
Table.TransformRows, Table.ToRows, Combiner.CombineTextByDelimiter.