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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

How to avoid using Table.Column when there are multiple columns in Power Query

This is my first post, please bare with me, and I am new in this forum, need help

 

I have a source data like as below

 

WillTaylorUK_0-1668151720193.png

 

And the end goal will be like this, 

 

WillTaylorUK_1-1668151770830.png

 

 

Presently I am using the power query with this code

 

let
Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
#"Grouped Rows" = Table.Group(Source, {"Name"}, {{"All", each _, type table [Name=text, Address=text, City=text, State=text]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.Column([All],"Address")),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each Table.Column([All],"City")),
#"Added Custom2" = Table.AddColumn(#"Added Custom1", "Custom.2", each Table.Column([All],"State")),
#"Extracted Values" = Table.TransformColumns(#"Added Custom2", {"Custom", each Text.Combine(List.Transform(_, Text.From), "|"), type text}),
#"Extracted Values1" = Table.TransformColumns(#"Extracted Values", {"Custom.1", each Text.Combine(List.Transform(_, Text.From), "|"), type text}),
#"Extracted Values2" = Table.TransformColumns(#"Extracted Values1", {"Custom.2", each Text.Combine(List.Transform(_, Text.From), "|"), type text}),
#"Removed Columns" = Table.RemoveColumns(#"Extracted Values2",{"All"})
in
#"Removed Columns"

 

In real there are around 30 columns, how can avoid using Table.Column or if I am using Table.Column then how to combine all the columns dynamcially to achieve the above end goal.

1 ACCEPTED SOLUTION
wdx223_Daniel
Community Champion
Community Champion

let
Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],

#"Grouped Rows" = Table.Group(Source, {"Name"}, List.Trandform(List.Skip(Table.ColumnNames(Source)),(x)=>{x,each Text.Combine(List.Transform(Table.Column(_,x),Text.From),"|")}))

in

#"Grouped Rows"

View solution in original post

1 REPLY 1
wdx223_Daniel
Community Champion
Community Champion

let
Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],

#"Grouped Rows" = Table.Group(Source, {"Name"}, List.Trandform(List.Skip(Table.ColumnNames(Source)),(x)=>{x,each Text.Combine(List.Transform(Table.Column(_,x),Text.From),"|")}))

in

#"Grouped Rows"

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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 Solution Authors