Table.FromValue
Makes a table out of any value: a single value, a list, or a record's fields.
Group: Table. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Table.FromValue(value as any, optional options as nullable record) as table
| Parameter | Type | Description |
|---|---|---|
value | any | The value to turn into a table. |
options | nullable record optional | A record of options: DefaultColumnName names the column the values go in. |
Returns
table. A list gives one row per item and a record one row per field, with its Name and Value; any other value gives a single row. The values are in a column named Value, or as DefaultColumnName says.
Examples
A single number
Table.FromValue(540)
| Value |
|---|
| 540 |
A record's fields
Table.FromValue([Product = "Chair", Price = 50])
| Name | Value |
|---|---|
| Product | Chair |
| Price | 50 |
A list, its column named
Table.FromValue({"Chair", "Desk"}, [DefaultColumnName = "Product"])
| Product |
|---|
| Chair |
| Desk |