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

Join 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.

Reply
Mike282
Helper III
Helper III

Group rows, concatenate then sort concatenated value alphabetically

Hi all,

 

So I've got a table with rows containing item line numbers and a group ID.

 

image.png

 

I've then managed to group them together and concatenate by a delimiter following the below post:

https://community.powerbi.com/t5/Desktop/Agroup-and-concatenate-column-with-a-common-value/td-p/2118...

 

This is technically what it suppose to look likeThis is technically what it suppose to look like

 

But when I go to add the concatenated values into a bar chart I noticed that the concatenated items are concantenated in an alphabetical order so even though technicall two grouped values have the same concatenated item value, BI treats them as two different things due to the order of the concatenated value. Is it possible to sort them alphabetically first then group them?

 

image.png

 

Kind regards,

Mike

1 ACCEPTED SOLUTION

@Mike282 I think you need to use table.buffer and then group it. Similar post here.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

6 REPLIES 6
parry2k
Super User
Super User

@Mike282 may be add a sort step before concatenate step, sort by Group and Item



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks @parry2k . I tried using the order.ascending function but it doesn't seem to sort correctly. Could you let me know what I need to sort? Below is the M script snippet for when I grouped the value:

 

    #"Sorted Rows" = Table.Sort(#"Expanded Items",{{"Items.Item", Order.Ascending}}),
    #"Grouped Rows" = Table.Group(#"Sorted Rows", {"Group"}, {{"Item Value", each Text.Combine([Items.Item],"|"), type text}}),

 

@Mike282 sort both on group and item, you are sorting only on item, which logically should work thou. How does your data looks like after sorting step?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi @parry2k ,

 

Thanks for the fast response! Still no luck. The concatenated values all concatenate together in random order.

 

Kind regards,

Mike

@Mike282 I think you need to use table.buffer and then group it. Similar post here.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks @parry2k ,

 

That seems to do the trick! Although the table buffer function seems to also at the same time slow query performance. 

Helpful resources

Announcements
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!

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.