Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I can’t figure how to do this in Power Query. I have a table with two columns, Product_ID and Product_Name. It turns out that in some cases I have multiple Product_Name s for a given Product_ID. What I want to do is convert these duplicates so Product_Name contains the concatenation of the product names.
For example
Product_ID | Product_Name |
1 | Apple |
1 | Peach |
2 | Cherry |
1 | Orange |
To
Product_ID | Product_Name |
1 | Apple_Peach_Orange |
2 | Cherry |
Any ideas?
Thanks,
-Wes
Solved! Go to Solution.
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXIsKMhJVYrVgfACUhOTM8A8IyDPOSO1qKgSLulflJiXDlQbCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Product_ID = _t, Product_Name = _t]),
#"Grouped Rows" = Table.Group(Source, {"Product_ID"}, {{"Count", each Text.Combine([Product_Name],"_"), type text}})
in
#"Grouped Rows"
Brilliant. Thanks so much.
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXIsKMhJVYrVgfACUhOTM8A8IyDPOSO1qKgSLulflJiXDlQbCwA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Product_ID = _t, Product_Name = _t]),
#"Grouped Rows" = Table.Group(Source, {"Product_ID"}, {{"Count", each Text.Combine([Product_Name],"_"), type text}})
in
#"Grouped Rows"
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
100 | |
54 | |
21 | |
12 | |
11 |