Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hi there!
I have a scenario to convert list to csv grouped by ID column, please help!
Input:
ID Name
1 A
1 B
1 C
2 D
3 E
3 F
Output:
ID Name
1 A,B,C
2 D
3 E,F
Solved! Go to Solution.
Hi @Anonymous ,
Try this:
Convert = CALCULATE(CONCATENATEX('Table','Table'[Name],","),ALLEXCEPT('Table','Table'[ID]))Insert your table name for 'Table'.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
Proud to be a Super User!
Option 4: https://stackoverflow.com/questions/44058355/powerquery-how-can-i-concatenate-grouped-values
Option 5: GroupedRows = Table.Group(Source, {"ID"}, {"Name", each Text.Combine(_[Name], ",")})
Thanks guys! so many options to choose from 😀
Hi,
This M code in the Query Editor works
let
Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Name", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"ID"}, {{"All Names", each Text.Combine(List.Distinct([Name]), ", "), type text}}),
Joined = Table.Join(Source, "ID", #"Grouped Rows", "ID"),
#"Removed Columns" = Table.RemoveColumns(Joined,{"Name"}),
#"Removed Duplicates" = Table.Distinct(#"Removed Columns")
in
#"Removed Duplicates"
Hope this helps.
Hi @Anonymous ,
Try this:
Convert = CALCULATE(CONCATENATEX('Table','Table'[Name],","),ALLEXCEPT('Table','Table'[ID]))Insert your table name for 'Table'.
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
Proud to be a Super User!
Hi @Anonymous ,
You can obtain that by creating a calculated table and using CONCATENATEX.
The Power BI file with the proposed solution is available from here.
Below is the DAX formula for the calculated table (you can create a calculated table by going to Modeling -> New Table)
Output = ADDCOLUMNS(
VALUES('Input'[ID])
, "Name",
VAR currentID = [ID]
RETURN CONCATENATEX(
FILTER('Input', 'Input'[ID]=currentID)
, [Name],",")
)This formula does the following: first, it creates a row for each distinct ID value. So you will have one row for ID 1, one row for ID 2, and one row for ID 3. Then, for each row, it finds all the names in your initial table.
For example, for row ID 1, it will find three names: A, B, and C.
Finally, it concatenates these names and separates them with a comma.
Here is a screenshot:
Hope this helps you! Do not hesitate if you have further questions.
LC
Interested in Power BI and DAX templates? Check out my blog at www.finance-bi.com
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 76 | |
| 37 | |
| 31 | |
| 27 | |
| 27 |