Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Klaimand
New Member

How to Aggregate data

Hello,

 

Im trying to aggregate data as follow:

Current data format:

ID   Name
1       A
1       B
1       C
2       D
2       E
3       F

 

Expected result:

ID     Name
1        A;B;C
2         D;E
3           F

 

Do you know how to build this step in my query?

 

Best regards,

2 ACCEPTED SOLUTIONS
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Klaimand,

Based on my test, you could refer to below formula:

Create a new table:

New Table = SUMMARIZE('Table1','Table1'[ID],"Name",CONCATENATEX('Table1','Table1'[Name],","))

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
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

Ashish_Mathur
Super User
Super User

Hi,

 

This M code works

 

let
    Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Name", type text}}),
    Combine = Table.Group(#"Changed Type", {"ID"}, {{"All Names", each Text.Combine(List.Distinct([Name]), "; "), type text}})
in
    Combine

Untitled.png


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

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

 

This M code works

 

let
    Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Name", type text}}),
    Combine = Table.Group(#"Changed Type", {"ID"}, {{"All Names", each Text.Combine(List.Distinct([Name]), "; "), type text}})
in
    Combine

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-danhe-msft
Microsoft Employee
Microsoft Employee

Hi @Klaimand,

Based on my test, you could refer to below formula:

Create a new table:

New Table = SUMMARIZE('Table1','Table1'[ID],"Name",CONCATENATEX('Table1','Table1'[Name],","))

Result:

1.PNG

You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
themistoklis
Community Champion
Community Champion

@Klaimand

 

Create a Measure and add the following formula:

 

Measure = CONCATENATEX ( VALUES ( 'Table'[Text] ), 'Table'[Text], ", " )

See workspace on this link.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors