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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Adam01
Advocate I
Advocate I

Combining Rows based on the ID of that table

Hello!

 

I am wanting to combine values based on the unique ID of that table, so for any values that have the same ID I want them to be pushed into the same cell. To explain this better I've included 2 screenshots labelled Old and New. Would I use Power Query or something to do with pivoting or grouping columns rows based on a column value? Unsure where to start 

Old.PNG Old (Table I have currently)

New.PNG New (Table I would like to have)

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

You can do this with a small tweak to Group By.

 

Click Group By under the Home tab and group by ID taking the max over Value.

AlexisOlson_0-1646411950875.png

This generates code that looks like this:

= Table.Group(#"Changed Type", {"ID"}, {{"Value", each List.Max([Value]), type nullable text}})

We don't actually want List.Max though. Replace that with Text.Combine like this:

= Table.Group(#"Changed Type", {"ID"}, {{"Value", each Text.Combine([Value], ", "), type text}})

AlexisOlson_1-1646412111397.png

View solution in original post

5 REPLIES 5
Syndicate_Admin
Administrator
Administrator

Hello Syndicate_Admin

Can this be done twice or more? Can you Group by ID and Date and Order Number all at once?

AlexisOlson
Super User
Super User

You can do this with a small tweak to Group By.

 

Click Group By under the Home tab and group by ID taking the max over Value.

AlexisOlson_0-1646411950875.png

This generates code that looks like this:

= Table.Group(#"Changed Type", {"ID"}, {{"Value", each List.Max([Value]), type nullable text}})

We don't actually want List.Max though. Replace that with Text.Combine like this:

= Table.Group(#"Changed Type", {"ID"}, {{"Value", each Text.Combine([Value], ", "), type text}})

AlexisOlson_1-1646412111397.png

Perfect! Thank you!

how to combine if the column has text and number both?

Thank you! This is exactly what I needed

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors