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

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.

Reply
Anonymous
Not applicable

How can I consolidate duplicate rows into a single row with concatenated values?

I have a table I have grouped in Power Query that contains duplicate IDs. I want to concatenate the differences between the values so I can have one row per ID using Power Query. Here is an example of the data:

 

ID       Vendor

1          Alpha

2          Alpha

2           Beta

3          Alpha

3           Beta

3         Gamma

 

As an example, I want to condense that data down to the following format:

 

ID              Vendor

1                 Alpha

2            Alpha, Beta

3     Alpha, Beta, Gamma

 

Any suggestions would be greatly appreciated.

1 ACCEPTED SOLUTION
PhilC
Resolver I
Resolver I

Try this:

 

#"Grouped Rows" = Table.Group(Source, {"ID"}, {{"Vendor", each Text.Combine([Vendor], ", "), type text}})

Based on the solution from @MarcelBeug in this post - https://community.powerbi.com/t5/Desktop/Combine-values-of-multiple-rows-in-one-row/td-p/308919

 

View solution in original post

2 REPLIES 2
PhilC
Resolver I
Resolver I

Try this:

 

#"Grouped Rows" = Table.Group(Source, {"ID"}, {{"Vendor", each Text.Combine([Vendor], ", "), type text}})

Based on the solution from @MarcelBeug in this post - https://community.powerbi.com/t5/Desktop/Combine-values-of-multiple-rows-in-one-row/td-p/308919

 

Anonymous
Not applicable

@PhilC, thanks for the suggestion! That worked once I modified the code as follows:

 

#"Grouped Rows" = Table.Group({"ID"}, {{"Vendor", each Text.Combine([Vendor], ", "), type text}})

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors