Forum Discussion
theapengelly
2 years agoFrequent Visitor
Concatenate one column and group by multiple
Hey,
I am trying to reduce the number of rows in my table, by concatenating distinct values in a particular column, but I want to leave all other columns the same.
How would I go from this
| Item | Client | Label |
| 244243 | 1 | A |
| 244243 | 1 | B |
| 244243 | 2 | A |
| 244243 | 2 | B |
| 244243 | 3 | A |
| 244243 | 3 | B |
| 244243 | 4 | A |
| 244243 | 4 | B |
| 176222 | 5 | B |
| 176222 | 6 | B |
To this:
| Item | Client | Label |
| 244243 | 1 | A,B |
| 244243 | 2 | A,B |
| 244243 | 3 | A,B |
| 244243 | 4 | A,B |
| 176222 | 5 | B |
| 176222 | 6 | B |
So I just want to concatenate the unique values in the Label column, and group by Item and Client?
Thanks so much!
try this:
Table.Group(Source, {"Item", "Client"}, {{"concat", each Text.Combine([Label], ", "), type text}})
3 Replies
- Smalfly
Responsive Resident
try this:
Table.Group(Source, {"Item", "Client"}, {{"concat", each Text.Combine([Label], ", "), type text}})
- DataNinja777
Super User
Hi theapengelly ,
You can produce your required output by writing a ConcatenateX measure like below:
ConcatenateX Label = concatenatex(distinct('Table'[Client Label]),'Table'[Client Label],", ")The required output is as shown below:
Best regards,
- theapengellyFrequent Visitor
Thank you this worked!