Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Mitsugu
Regular Visitor

Expand each table dynamically from list, using list sequence as equivalence for like columns

I'm looking for a command similar to the Table.ExpandTableColumn() with a change to the required column extraction for each table.

 

Mitsugu_0-1677788112404.png

 

 

= Table.ExpandTableColumn(Source, "ColumntoExpand", ColumnfromTable, ColumnfromTableRenamed)

 

 

I have your typical grouped data in [Name] and [Custom] meaning all column names in each Table cell will be the same.

 

However, the data within is not organised and the essence is;

 

Column dataName and Index.2Actual Column in Table Cell
DateS1, 1Column1
 S1, 2Column5
 S1, 3Column6

 

bassically what I have.

I do, however, have a list of column names in [List]

 

Name and IndexList
S1, 1
Column1
Column2
Column3
S1, 2
Column2
Column3
Column5
Column7

 

Column1 from "S1, 1" holds the same data as Column2 in "S1,2" and I would like to extract and treat them as the same column. The list will not always have the same amount of columns extract and I can create a new named list as the column headers for it if required.

1 ACCEPTED SOLUTION

then transform the custom column firstly, then click to expand it.

NewStep=Table.CombineColumns(PreviousStepName,{"Custom","List"},each Table.Skip(Table.DemoteHeaders(Table.SelectColumns(_{0},_{1}))),"Custom")

View solution in original post

4 REPLIES 4
wdx223_Daniel
Super User
Super User

NewStep=Table.FromColumns(List.Zip(List.TransformMany(Table.ToRecords(PreviousStepName),each Table.ToRows(Table.SelectColumns([Custom],[List])),(x,y)=>y)))

Thank you so much, it works great!

I did notice though that the formula only looks at the [Custom] column and doesn't retain any of the information from the other columns. Is there a way to retain that information while expanding the tables?

then transform the custom column firstly, then click to expand it.

NewStep=Table.CombineColumns(PreviousStepName,{"Custom","List"},each Table.Skip(Table.DemoteHeaders(Table.SelectColumns(_{0},_{1}))),"Custom")

Thanks Daniel!

Took me a while to get but I got your formula working now~

 

= Table.CombineColumns(SourcetoExpand2,{"Custom", "List"},each Table.Skip(Table.DemoteHeaders(Table.SelectColumns(_{0},_{1})), 1),"Custom")

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.