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 September 15. Request your voucher.

Reply
Ndwhite
Regular Visitor

How do I custom sort values in powerbi?

Hi! Former Tableau user here. How do I custom sort values in table in PowerBI? I just want to reorder certain items in a non-alphabetical and non-descending or ascending order. In Tableau, all you have to do is drag the values you want to reorder. Am I missing something here? 

 

I do not want to have to create custom dax queries and special reference columns to do simple things. 

2 ACCEPTED SOLUTIONS
muhammad_786_1
Super User
Super User

Hi,

 

You can add a Sort Column to your dataset to specify the order of the values you want. Then you can use the "Sort by Column" feature in Power BI to apply that custom sort order.

 

Best Regards,
Muhammad Yousaf

 

LinkedIn

View solution in original post

Anonymous
Not applicable

Hi @Ndwhite ,

 

If you want to sort your column by asc or des, you can do this in Power Query Editor.

If you want to customize the sorting of the columns, you need to add a reference column as mentioned above.

As far as I know, it is not a good way to add the reference column in your table by IF or SWITCH (Dax) directly.
Power BI will return a circule error if you sort by this column.

It is better for you to add this reference column in Power Query Editor (M Query) or Dataset.
You can also create a new table with unique key column and sort value then create a relationship with your data table.

I think you can refer to this offical blog to learn how to use "Sort by column" function.

Sort one column by another column in Power BI - Power BI | Microsoft Learn

 

Best Regards,
Rico Zhou

 

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

4 REPLIES 4
Anonymous
Not applicable

Hi @Ndwhite ,

 

If you want to sort your column by asc or des, you can do this in Power Query Editor.

If you want to customize the sorting of the columns, you need to add a reference column as mentioned above.

As far as I know, it is not a good way to add the reference column in your table by IF or SWITCH (Dax) directly.
Power BI will return a circule error if you sort by this column.

It is better for you to add this reference column in Power Query Editor (M Query) or Dataset.
You can also create a new table with unique key column and sort value then create a relationship with your data table.

I think you can refer to this offical blog to learn how to use "Sort by column" function.

Sort one column by another column in Power BI - Power BI | Microsoft Learn

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

VahidDM
Super User
Super User

Hey @Ndwhite 

 

If you want to sort column A, in a custom way, then you need to add another column (let's call it B) with the number or alphabetic in a same way you wanna sort column A. Then select column A, in the column options, sort this column with column B and that will work.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!! 

LinkedIn|Twitter|Blog |YouTube 

muhammad_786_1
Super User
Super User

Hi,

 

You can add a Sort Column to your dataset to specify the order of the values you want. Then you can use the "Sort by Column" feature in Power BI to apply that custom sort order.

 

Best Regards,
Muhammad Yousaf

 

LinkedIn

amitchandak
Super User
Super User

@Ndwhite , You can sort the column. You can have an order in that. But if You create a new column B from A to have sort order then you can mark B as Sort column A(Unless done in power query). So do like

 

C= [A]

B = Switch([A],

"XY",1 ,

"AB", 2 ) // Add more rows

 

Now mark B as sort column on C and use C in visual

 

Refer How to Create Sort Column and Solve Related Errors:
https://www.youtube.com/watch?v=KK1zu4MBb-c

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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