Tricks in Table.CombineColumns Function - Power Query
- V E Meganathan
- 4 days ago
- 1 min read
Utilize Table.CombineColumns Function to Combine Multiple Columns:

The Table.CombineColumns function allows us to combine several columns together.
sourceColumns argument enables us to specify the names of the columns we intend to combine.
The third argument is a combiner function; by using each _ in this argument, we can consolidate items from the source columns into a list format.
We can then manipulate this list to achieve our desired outcome.
In this instance, we took advantage of this functionality to expand the Order ID and Product Column according to the Qty Column.
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Combine = Table.CombineColumns(Source,List.Skip(Table.ColumnNames(Source)), each List.Repeat({_{0}},_{1}) , "Product"),
Result = Table.ExpandListColumn(Combine,"Product")
in
Result
Table.CombineColums Function to combine set of Columns in Table:

Our dataset includes the Price and Quantity of Fruits for each quarter.
We need to compute the sales number of Fruits for every quarter.
I will demonstrate a technique that combines the List.Accumulate Function with the Table.CombineColumns Function.
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
Result = List.Accumulate(List.Split(List.Skip(Table.ColumnNames(Source)),2), Table.Skip(Source), (s,c) => Table.CombineColumns(s,c,each List.Product(_),c{0}))
in
Result
Comments