Table.ExpandTableColumn
Expands a column of records or a column of tables into multiple columns in the containing table.
Syntax
Table.ExpandTableColumn(
table as table,
column as text,
columnNames as list,
optional newColumnNames as list
) as table
Remarks
Expands tables in table
[column
] into multiple rows and columns. columnNames
is used to select the columns to expand from the inner table. Specify newColumnNames
to avoid conflicts between existing columns and new columns.
Examples
Example #1
Expand table columns in <code>[a]</code> in the table <code>({[t = {[a=1, b=2, c=3], [a=2,b=4,c=6]}, b = 2]})</code> into 3 columns <code>[t.a]</code>, <code>[t.b]</code> and <code>[t.c]</code>.
Table.ExpandTableColumn(
Table.FromRecords({
[
t = Table.FromRecords({
[a = 1, b = 2, c = 3],
[a = 2, b = 4, c = 6]
}),
b = 2
]
}),
"t",
{"a", "b", "c"},
{"t.a", "t.b", "t.c"}
)
Result:
Table.FromRecords({
[t.a = 1, t.b = 2, t.c = 3, b = 2],
[t.a = 2, t.b = 4, t.c = 6, b = 2]
})
Category
Table.Transformation