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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
Employee
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
Employee
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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.