Table.ExpandRecordColumn
TableExpands a column of records into individual columns.
Syntax
Table.ExpandRecordColumn(table as table, column as text, fieldNames as list, optional newColumnNames as nullable list) as tableParameters
| Name | Type | Required | Description |
|---|---|---|---|
table | table | Yes | The input table containing a record column to expand. |
column | text | Yes | The name of the column containing records to expand. |
fieldNames | list | Yes | A list of field names from the records to expand into columns. |
newColumnNames | list | No | Optional list of new column names for the expanded fields. Must match the length of fieldNames. |
Return Value
table — A table with the specified record column replaced by individual columns for each field.
Remarks
Table.ExpandRecordColumn replaces a column of records with individual columns for each specified field. This commonly occurs when working with JSON or API data that contains nested objects, or when a custom column returns a record with multiple computed values.
Use the optional newColumnNames parameter to rename fields during expansion — for example, to add a prefix and avoid name collisions with existing columns.
Unlike Table.ExpandTableColumn (which expands nested tables), this function expands records — single rows of named fields.
Examples
Example 1: Expand computed record fields
let
Source = Table.SelectColumns(Table.FirstN(Sales, 3), {"OrderID", "CustomerName", "UnitPrice", "Quantity"}),
WithCalc = Table.AddColumn(Source, "Calc", each [Total = [UnitPrice] * [Quantity], DoubleQty = [Quantity] * 2])
in
Table.ExpandRecordColumn(WithCalc, "Calc", {"Total", "DoubleQty"})Result
OrderID | CustomerName | UnitPrice | Quantity | Total | DoubleQty | |
|---|---|---|---|---|---|---|
| 1 | 1 | Alice | 25 | 4 | 100 | 8 |
| 2 | 2 | Bob | 50 | 2 | 100 | 4 |
| 3 | 3 | Charlie | 15 | 10 | 150 | 20 |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks