Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Grouping rows by like values and combining subsequent columns
05-30-2023
07:00 PM
Hello! I have a problem that I am sure is probably pretty basic but my brain has quit functioning and I can't get past this. I have a table with two columns. An ID column and a Service column. Shown below:
ID | Service |
65895976 | 10 |
86019440 | 12 |
86019440 | 10 |
65895976 | 20 |
65895976 | 30 |
86019440 | 12 |
65895976 | 10 |
87335274 | 20 |
30595323 | 20 |
84777902 | 10 |
84777902 | 30 |
84777902 | 50 |
45320398 | 10 |
65895976 | 10 |
88852113 | 20 |
As you can see, the ID column has duplicate values, I would like to combine the duplicates in the ID column and then concatenate the Service column for each row as shown below:
ID | Service |
65895976 | 10,20,30,10 |
86019440 | 12,10 |
87335274 | 20 |
30595323 | 20 |
84777902 | 10,30,50 |
45320398 | 10 |
88852113 | 20 |
ANy help would be GREATLY aooreciated!!!
Solved! Go to Solution.
1 ACCEPTED SOLUTION
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023
07:07 PM

Hi,
This M code works
let
Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Service", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"ID"}, {{"All services", each Text.Combine([Service], ", ")}})
in
#"Grouped Rows"
Hope this helps.
Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023
07:07 PM

Hi,
This M code works
let
Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Service", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"ID"}, {{"All services", each Text.Combine([Service], ", ")}})
in
#"Grouped Rows"
Hope this helps.
Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2023
12:41 PM

Perfect! Thank you so much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2023
04:12 PM

You are welcome.
Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources
Recommendations
Subject | Author | Posted | |
---|---|---|---|
08-02-2024 11:49 AM | |||
04-25-2024 01:43 AM | |||
10-02-2024 10:08 AM | |||
03-22-2024 06:48 AM | |||
08-12-2024 10:10 PM |
Featured Topics
Top Solution Authors (Last Month)
User | Count |
---|---|
89 | |
82 | |
53 | |
40 | |
35 |