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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
DanFromMontreal
Helper IV
Helper IV

Agregate multiple names into one cell

Heelo dear community,

I'm struggling to develop the code to obtain the 3 output below.

My table contains 2 columns... Fruit and Name.

It surely as to do with List but cannot make it work.

Help would be appreciated.

 

  Output 1Output 2Output 3
FruitNameCount Fruit FrequencyCustomer (no duplication)Customer (w/duplication)
AppleDan2Dan , IreneDan , Irene
BananaJustin1JustinJustin
AppleIrene2Dan , IreneDan , Irene
PearDan4Dan, Bob, JackDan, Bob, Jack, Dan
PearBob4Dan, Bob, JackDan, Bob, Jack, Dan
PearJack4Dan, Bob, JackDan, Bob, Jack, Dan
PearDan4Dan, Bob, JackDan, Bob, Jack, Dan

 

2 ACCEPTED SOLUTIONS
ronrsnfld
Super User
Super User

You can add Custom Column:

 

For Customer with duplications, in the Custom Column dialog box:

Text.Combine(
Table.SelectRows(#"Changed Type", (r)=>r[Fruit]=[Fruit])[Name], ", ")

 

For Customer with no duplications:

Text.Combine(List.Distinct(
Table.SelectRows(#"Changed Type", (r)=>r[Fruit]=[Fruit])[Name]), ", ")

 

View solution in original post

Thank you SundarRaj - its working 🙂

View solution in original post

4 REPLIES 4
ronrsnfld
Super User
Super User

You can add Custom Column:

 

For Customer with duplications, in the Custom Column dialog box:

Text.Combine(
Table.SelectRows(#"Changed Type", (r)=>r[Fruit]=[Fruit])[Name], ", ")

 

For Customer with no duplications:

Text.Combine(List.Distinct(
Table.SelectRows(#"Changed Type", (r)=>r[Fruit]=[Fruit])[Name]), ", ")

 

Akash_Varuna
Super User
Super User

Hi @DanFromMontreal , You could Achive this with Power Query with Group By Try this please

1.Count Fruit Frequency
Table.Group(#"PreviousStep", {"Fruit"}, {{"Count Fruit Frequency", each Table.RowCount(_), Int64.Type}})

2. Customer (No Duplication)
Table.Group(#"PreviousStep", {"Fruit"}, {{"Customer (no duplication)", each Text.Combine(List.Distinct([Name]), ", "), type text}})

3. Customer (With Duplication)
Table.Group(#"PreviousStep", {"Fruit"}, {{"Customer (w/duplication)", each Text.Combine([Name], ", "), type text}})

If this post helped please do give a kudos and accept this as a solution
Thanks In Advance

SundarRaj
Super User
Super User

Hi @DanFromMontreal , here's the solution to your query. I'll attach the output image and the snippet of the M code used below for reference. Thanks

SundarRaj_0-1740163556702.png

SundarRaj_1-1740163594562.png

 

 

Sundar Rajagopalan

Thank you SundarRaj - its working 🙂

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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 Kudoed Authors