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
Rose1976
Regular Visitor

How do I create a measure to sort categories the way I want?

Hi, I need to sort my categories into a specic order.  I have created a new table which as a unique number associated with each of the categories.  But believe I now need to create a measure to make it work? can anyone help me with how the code should look please?

2 ACCEPTED SOLUTIONS
tjd
Impactful Individual
Impactful Individual

Highlight the column of category names in the Data view.  Then, on the Modeling ribbon, click the down arrow for Sort by Column and select the column name with the sort order that you want.

View solution in original post

v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Rose1976,

 

If I understand correctly, different from sorting column based on numberic or alphabetical order, you want to sort the category column based on a custom order, right? If so, please refer to below steps.

 

First, you should create a custom column in Query Editor mode.

1.PNG

 

Save changes and go back to data view mode. On the Modeling ribbon, click the down arrow for Sort by Column and select [Sort order] column which you have created before.

2.PNG

3.PNG

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
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

2 REPLIES 2
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Rose1976,

 

If I understand correctly, different from sorting column based on numberic or alphabetical order, you want to sort the category column based on a custom order, right? If so, please refer to below steps.

 

First, you should create a custom column in Query Editor mode.

1.PNG

 

Save changes and go back to data view mode. On the Modeling ribbon, click the down arrow for Sort by Column and select [Sort order] column which you have created before.

2.PNG

3.PNG

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
tjd
Impactful Individual
Impactful Individual

Highlight the column of category names in the Data view.  Then, on the Modeling ribbon, click the down arrow for Sort by Column and select the column name with the sort order that you want.

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.