Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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
And the end goal will be like this,
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.
Solved! Go to Solution.
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"
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"
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!