cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pbiuser2 Member
Member

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

Accepted Solutions
Highlighted
PhilC Regular Visitor
Regular Visitor

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

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

 

2 REPLIES 2
Highlighted
PhilC Regular Visitor
Regular Visitor

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

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

 

pbiuser2 Member
Member

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

@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
Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

Virtual Launch Event

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Users Online
Currently online: 307 members 3,327 guests
Please welcome our newest community members: