Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Administrator
3 years ago

Sorting columns in a graph

Good morning

I have a chart with x number of columns but one of them I want to always appear first, as if it were independent of the order of the rest of the columns.

Let me explain:

As you can see the columns are ordered from highest to lowest.

Objective: To ensure that the first column is always the E and then the rest of the columns are ordered from highest to lowest or from lowest to highest.

the order from highest to lowest would be E, A, B, C, D

the order from lowest to highest would be E, D, C, B, A

I hope you can help me, thanks and greetings

4 Replies

  • Hi,

     

    If it is okay to perform sorting using an auxiliary slicer, I can propose such a solution.

     

    1. We create an additional table with the options "asc" and "desc". It will be used in a slicer.

     

    2. We create a measure like this:

    Parameter for sorting = 
    VAR factor = IF ( SELECTEDVALUE('order'[order]) = "desc", 1, -1 )
    VAR res = IF ( SELECTEDVALUE ( data[Parameter] ) = "E", 
                       factor * SUM ( data[Value] ) + 1000,
                       factor * SUM ( data[Value] ) )
    RETURN res

     

    3. We add this measure to the Tooltips section of our bar chart - thus, it will appear in the "Sort axis" list.

     

    4. Then we choose this measure in the sorting options and choose "Sort descending."

     

    Here is the result for both options:

     

    Should you need any clarifications, please let me know.

     

  • Good morning

    Everything was perfect, I did it and it works properly. The only doubt I have is that when adding tooltip that information is displayed in the tooltip, how could I hide the text? Thanks a lot

    I just want to visualize Department and utilization. Thanks again

    • barritown's avatar
      barritown
      Solution Sage

      Hi,

      Unfortunately, that's a drawback of this method, and this caption cannot be easily removed from the tooltip.

      With the title, it is pretty easy to fix: 

       

      Back to the tooltip, you have two options I guess:

      1) You can create a custom tooltip and leave only the parameters you want to be there. Check the video in my vlog on this topic if you like - https://youtu.be/C498utF7Ldg.

      2) You can simply turn off the tooltip so it won't bother you. Here:

      Best Regards,

      Alexander

      My YouTube vlog in English

      My YouTube vlog in Russian