cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

Remove replicated values in a grouped column

Hello,

I have some data on various invoices with a department and client column.  Some invoices can apply to either multiple clients or multiple departments.

Capture1.PNG

I use Group By a to concatenate the Client and Department values on a single row.

 

That works, except that I get combination of the same values for the respective fields.  

Capture2.PNG

How can I get only unique values for each column? 

i.e. for Invoice 1, I want Used; A,F and for Invoice 5 I want Used,Repair; E.

 

Thank you.

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Remove replicated values in a grouped column

@huguest ,

 

Try code below:

Result = Table.Group(#"Changed Type", {"Invoice"}, {{"Department Concatenated", each Text.Combine(List.Distinct([Department]), ","), type text}, {"Client Concatenated", each Text.Combine(List.Distinct([Client]), ","), type text}})

Capture.PNG  

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Super User IV
Super User IV

Re: Remove replicated values in a grouped column

Hi @huguest

 

Just add List. Distinct before Text.Combine

= Table.Group(#"Changed Type", {"Invoice"}, {{"Department", each Text.Combine( List.Distinct([Department]), ", " ), type text}, {"Client", each Text.Combine( List.Distinct([Client]), ", "), type text}})

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Remove replicated values in a grouped column

@huguest ,

 

Try code below:

Result = Table.Group(#"Changed Type", {"Invoice"}, {{"Department Concatenated", each Text.Combine(List.Distinct([Department]), ","), type text}, {"Client Concatenated", each Text.Combine(List.Distinct([Client]), ","), type text}})

Capture.PNG  

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Super User IV
Super User IV

Re: Remove replicated values in a grouped column

Hi @huguest

 

Just add List. Distinct before Text.Combine

= Table.Group(#"Changed Type", {"Invoice"}, {{"Department", each Text.Combine( List.Distinct([Department]), ", " ), type text}, {"Client", each Text.Combine( List.Distinct([Client]), ", "), type text}})

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

View solution in original post

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors