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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Append Dynamically

My requirement should be fairly achievavble (to all the PQ Experts 🙂 

 

I have data coming in horizontally and I want to stack certain columns below it. The below SS will tell you better. Please advise..

 

This is what I have 

 

mandar_manik_0-1644246738863.png

 

This is what I need

 

mandar_manik_1-1644246759460.png

 

**Note: The table will continue to expand horizontally. So the stacking must happen dynamically**

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

  1. Split the list of column names into pairs using List.Split.
  2. Combine all the number columns by taking the values from the first column name in each pair.
  3. Combine all the text columns by taking the values from the second column name in each pair.
  4. Combine these two lists into a single table using Table.FromColumns.

Here's a full sample query you can paste into the Advanced Editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUUoEYhMgTgZicyBOU4rViVYyArKSgNgUiFOA2AKI08EyxlC1ZkCcCsSWQJyhFBsLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t, Column5 = _t, Column6 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}, {"Column2", type text}, {"Column3", Int64.Type}, {"Column4", type text}, {"Column5", Int64.Type}, {"Column6", type text}}),
    ColPairs = List.Split(Table.ColumnNames(#"Changed Type"), 2),
    NumberCol = List.Combine(List.Transform(List.Transform(ColPairs, each _{0}), each Table.Column(#"Changed Type", _))),
    TextCol = List.Combine(List.Transform(List.Transform(ColPairs, each _{1}), each Table.Column(#"Changed Type", _))),
    Combined = Table.FromColumns({NumberCol, TextCol}, {"Number", "Text"})
in
    Combined

View solution in original post

4 REPLIES 4
AlexisOlson
Super User
Super User

  1. Split the list of column names into pairs using List.Split.
  2. Combine all the number columns by taking the values from the first column name in each pair.
  3. Combine all the text columns by taking the values from the second column name in each pair.
  4. Combine these two lists into a single table using Table.FromColumns.

Here's a full sample query you can paste into the Advanced Editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUUoEYhMgTgZicyBOU4rViVYyArKSgNgUiFOA2AKI08EyxlC1ZkCcCsSWQJyhFBsLAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t, Column4 = _t, Column5 = _t, Column6 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", Int64.Type}, {"Column2", type text}, {"Column3", Int64.Type}, {"Column4", type text}, {"Column5", Int64.Type}, {"Column6", type text}}),
    ColPairs = List.Split(Table.ColumnNames(#"Changed Type"), 2),
    NumberCol = List.Combine(List.Transform(List.Transform(ColPairs, each _{0}), each Table.Column(#"Changed Type", _))),
    TextCol = List.Combine(List.Transform(List.Transform(ColPairs, each _{1}), each Table.Column(#"Changed Type", _))),
    Combined = Table.FromColumns({NumberCol, TextCol}, {"Number", "Text"})
in
    Combined
Anonymous
Not applicable

Thanks a lot!

AlexisOlson
Super User
Super User

When you say "continue to expand horizontally", do you mean you'll be adding additional columns (and they'll always come in ordered pairs of number and text)?

Anonymous
Not applicable

Yes thats right. It will always be ordered and same data type.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.

Top Kudoed Authors