Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Custom Sort of a Pivot Table

Hi,

 

I have a sales table with many informations, and I built a "pivot table" with these exactly informations, in order to everyone can see detailes of a sale, as the image bellow:

 

 

Each sale has an ID code, so to create this pivot table, I put the ID in the field Line Value, and all the other informations in the field Values, as the image bellow:

 

 

Now I'm trying to sort this pivot table by the field Probability (in portuguese, "probabilidade"), wich can be mainly "Very High", "High" or "Medium". To get this, I can't sort alphabetically, so I add another Table wich shows the ranks and then made a conection in power query, as the images bellow:

 

      

 

The problem is that I can't replace the old"Probability" with the new, because it will get just the first result for every sale, and I cant put in the another field as well, otherwise it will make a mess in my pivot table as the image bellow:

 

 

How can I fix this problem and add a custom sort?

 

 

 

 

 

3 Replies

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

    Hi, Anonymous 

    To deal with the custom sorting for the columns in the Power BI, we usually use the “Sort by column” function to sort the column values based on our ideal order.

     

    You can refer to this document:

    https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-sort-by-column

     

    Thank you very much!

     

    Best Regards,

    Community Support Team _Robert Qin

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      As I mentioned, I tryed sort by this way by creating an auxiliar table and sorting by the column "Indice" as the image bellow:

       

       

      However, when I replace the old probability field by the newest one (the one sorted by "Indice"), it shows the same probability for all sales. 

       

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

        Hi, Anonymous 

        As far as I’m concerned, you don’t have to create a new auxiliary table to sort the column value by order, you can just add an index column within the original table to apply the “Sort by column”.

        Thank you very much!

         

        Best Regards,

        Community Support Team _Robert Qin

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