Forum Discussion

Lora_0121's avatar
Lora_0121
Advocate I
1 year ago
Solved

How to Customize Sorting

Hello.

 

Can you tell me how to sort categories in text format?

For example, there are categories like low, medium, and high. I want to fix the sort order as medium, high, and low.

I know how to create a table with columns for sort order, create relationships, and then sort by those columns.

 

Is there another way?

I want to know different ways to customize sort order.

 

  • Hay Lora_0121 as you already know the cool way "Sort by Column" to sort any text categorical data like "Low, Medium, High". Here are some other methods you can try:

    • Use calculated column with help of dax 
    • Create a table in Power Query with index or conditional columns 
    • Enter data and then create sort by columns

    I think these are the ways to solve sort by categorical columns and you are in good stage. You only know different methods or is there any specefic functionality you want to achieve that, the bese options Sort by Column is not helping you? 

    Is it helped? ✔ Give a Kudo • Mark as Solution – help others too!

6 Replies

  • You've already done it. The column itself can be sorted alphabetically or using a custom sort column or, if together with a measure, the measure itself (eg. sum of sales, transaction count, etc). No other way.

  • Royel's avatar
    Royel
    Super User

    Hay Lora_0121 as you already know the cool way "Sort by Column" to sort any text categorical data like "Low, Medium, High". Here are some other methods you can try:

    • Use calculated column with help of dax 
    • Create a table in Power Query with index or conditional columns 
    • Enter data and then create sort by columns

    I think these are the ways to solve sort by categorical columns and you are in good stage. You only know different methods or is there any specefic functionality you want to achieve that, the bese options Sort by Column is not helping you? 

    Is it helped? ✔ Give a Kudo • Mark as Solution – help others too!

  • Hi there,

    Yes, besides creating a custom sort column, you have a couple of other options to control sort order in Power BI:

    1. Sort by Column in the Same Table
      If your categories are already in a table, you can add a calculated column using DAX that assigns numbers to your text values (for example: Medium = 1, High = 2, Low = 3). Then use Sort by Column to apply the order.

    2. Use a Manual Sort in a Visual
      In some visuals (like bar or column charts), you can manually drag the categories into the order you want by sorting on the axis field — this is limited but useful for small lists.

    3. Leverage a Switch Function in DAX
      You can create a measure with a SWITCH statement to define the order logic. 

    Each method depends on whether you want the order to apply just in a visual or consistently across your model.

    Hope this helps!

     

  • v-nmadadi-msft's avatar
    v-nmadadi-msft
    Community Support

    Hi Lora_0121 ,

    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.


    Thank you.

  • v-nmadadi-msft's avatar
    v-nmadadi-msft
    Community Support

    Hi Lora_0121 

    May I check if this issue has been resolved? If not, Please feel free to contact us if you have any further questions.


    Thank you

  • v-nmadadi-msft's avatar
    v-nmadadi-msft
    Community Support

    Hi Lora_0121 

    As we haven’t heard back from you, we wanted to kindly follow up to check if the suggestions  provided by the community members for the issue worked. Please feel free to contact us if you have any further questions.

     

    Thanks and regards