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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hello,
Is it possible to convert this table in PowerQuery:
ID | Type |
1000 | A |
1000 | B |
1000 | C |
1001 | C |
1002 | C |
to this view:
ID | Type |
1000 | A B C |
1001 | C |
1002 | C |
NOTE: there can be more or less than 3 values for Types (depends on user input).
Thanks in Advance!
Solved! Go to Solution.
Yes @alai9 - see this code.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQwMFDSUXJUitWBc5yQOc4wjiEyxwjCiQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Type = _t]),
#"Grouped Rows" = Table.Group(Source, {"ID"}, {{"AllRows", each _, type table [ID=nullable text, Type=nullable text]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Text.Combine([AllRows][Type], " ")),
#"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"ID", "Custom"})
in
#"Removed Other Columns"
It turns this:
into this:
How to use M code provided in a blank query:
1) In Power Query, select New Source, then Blank Query
2) On the Home ribbon, select "Advanced Editor" button
3) Remove everything you see, then paste the M code I've given you in that box.
4) Press Done
5) See this article if you need help using this M code in your model.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingHi, @alai9
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may add a new step with following m codes.
= Table.Group(#"Changed Type", {"ID"}, {{"Type", each Text.Combine(_[Type]," "),type text}})
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @alai9
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
You may add a new step with following m codes.
= Table.Group(#"Changed Type", {"ID"}, {{"Type", each Text.Combine(_[Type]," "),type text}})
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Yes @alai9 - see this code.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQwMFDSUXJUitWBc5yQOc4wjiEyxwjCiQUA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, Type = _t]),
#"Grouped Rows" = Table.Group(Source, {"ID"}, {{"AllRows", each _, type table [ID=nullable text, Type=nullable text]}}),
#"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Text.Combine([AllRows][Type], " ")),
#"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"ID", "Custom"})
in
#"Removed Other Columns"
It turns this:
into this:
How to use M code provided in a blank query:
1) In Power Query, select New Source, then Blank Query
2) On the Home ribbon, select "Advanced Editor" button
3) Remove everything you see, then paste the M code I've given you in that box.
4) Press Done
5) See this article if you need help using this M code in your model.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingJoin the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.