OpenBI Docs Buy

Table.CombineColumnsToRecord

Gathers several columns into one column of records, a field per column.

Group: Table. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Table.CombineColumnsToRecord(table as table, newColumnName as text, sourceColumns as list, optional options as nullable record) as table
ParameterTypeDescription
tabletableThe table with the columns.
newColumnNametextThe name of the record column.
sourceColumnslistThe columns that become the records' fields.
optionsnullable record
optional
Options for the new column.

Returns

table. The table with the source columns replaced by the record column.

Remarks

Examples

An address record

let
    Shops = #table({"Shop", "Street", "City"}, {{"Oslo", "Storgata 1", "Oslo"}, {"Bergen", "Torget 2", "Bergen"}})
in
    Table.CombineColumnsToRecord(Shops, "Address", {"Street", "City"})
ShopAddress
Oslo[Street = "Storgata 1", City = "Oslo"]
Bergen[Street = "Torget 2", City = "Bergen"]

Table.ExpandRecordColumn, Table.CombineColumns, Table.ToRecords.

Last updated · OpenBI Studio 0.3.79