Table.ExpandRecordColumn

Table

Expands a column of records into individual columns.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Table.ExpandRecordColumn(table as table, column as text, fieldNames as list, optional newColumnNames as nullable list) as table

Parameters

NameTypeRequiredDescription
tabletableYesThe input table containing a record column to expand.
columntextYesThe name of the column containing records to expand.
fieldNameslistYesA list of field names from the records to expand into columns.
newColumnNameslistNoOptional list of new column names for the expanded fields. Must match the length of fieldNames.

Return Value

tableA 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
11Alice2541008
22Bob5021004
33Charlie151015020

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks