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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
vinothkumar1990
Helper II
Helper II

How to sort the values within a column in Power BI

Hi,

I have a column called Col1 which contian value like 456,123,789.

Meaning values within the column are seperated by comma. 

 

I want to sort the value like 123,456,789.

 

Note - Some columns can have any set of values e.g. 123,456,789 or 123,678 or 456,123,491,756.

 

Is there anyway to do the sorting winthin a column.

 

Thanks in advance!

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

This M code works

let
    Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
    #"Added Custom" = Table.AddColumn(Source, "Custom", each Text.Combine(List.Sort(Text.Split([Values],","),Order.Ascending),","))
in
    #"Added Custom"

Hope this helps.

Ashish_Mathur_0-1717630967769.png

 


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

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

This M code works

let
    Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
    #"Added Custom" = Table.AddColumn(Source, "Custom", each Text.Combine(List.Sort(Text.Split([Values],","),Order.Ascending),","))
in
    #"Added Custom"

Hope this helps.

Ashish_Mathur_0-1717630967769.png

 


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

@vinothkumar1990  - you'll have to split the data in the column. In Power Query when you split column by delimeter, you can expand the advanced options and split by rows. Then you could sort the column, and if you really needed to recombine you could merge the data back together using a group by and custom function.


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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