Table.FromColumns
Makes a table from lists, each list a column.
Group: Table. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Table.FromColumns(lists as list, optional columns as any) as table
| Parameter | Type | Description |
|---|---|---|
lists | list | The columns' values, one list per column. |
columns | any optional | The column names as a list, a number of columns, or a table type; Column1, Column2 and so on when left out. |
Returns
table. A table with as many rows as the longest list; a shorter list gives null in the rows it lacks.
Examples
Products and prices
Table.FromColumns({{"Chair", "Desk", "Lamp"}, {50, 120, 30}}, {"Product", "Price"})
| Product | Price |
|---|---|
| Chair | 50 |
| Desk | 120 |
| Lamp | 30 |
Lists of different lengths
Table.FromColumns({{"Chair", "Desk", "Lamp"}, {50, 120}})
| Column1 | Column2 |
|---|---|
| Chair | 50 |
| Desk | 120 |
| Lamp | null |