Forum Discussion

F_Reh's avatar
F_Reh
Post Patron
9 months ago
Solved

Arranging Legend segments in Graph by Numerical Ordering

Hello,

 

I have a graph as such:

 

 

 

The Ordering from left-to-right, is basically as per the Legend Groups order (as they are listed). However, it will be more beneficial to see the Legend segments numerically ordered. It would make it easier at a glance to see which Legend groups have the highest and lowest performances without always needing to strain at the values themselves.

 

Kindly advise how this can be possible.

 

  • F_Reh , We have got new option in the Stacked visual 
    Under Bar/Column - Sort By Value (That will sort the legend by measure)

     

     

3 Replies

  • Hii F_Reh 

     

    1. Create a numeric sort column in the Legend table
      In your Dimension/Legend table, add a column like:
    Sort Order =
    SWITCH(
        [LegendName],
        "A", 1,
        "B", 2,
        "C", 3,
        "D", 4,
        so on
    )

    or based on whatever rule matches the actual numeric order you want in your legend.

     

    1. Tell Power BI to sort by that numeric column

    Go to:

    Data View >> Select the Legend column >> Sort by Column >> choose your Sort Order column

     

    1. Refresh your visual

    Now your Stacked Bar / Column chart will arrange legend segments in numeric order, not alphabetical.

     

  • So the X-Axis is based on a measure like this:

     

    <Final Measure %>= DIVIDE([<Numerator_Measure1>] + [<Numerator_Measure2>], [<Denominator_Measure>])
     
    rohit1991 I am not clear how to incorporate the above suggestion (kindly provided) with these measures. Would that not mean making a separate "summary" table for storing already-calculated Legend %s  ?! The Page has multiple graphs - by age, by ethnicity etc so it would'nt be practical to make multiple new "summary" tables for the %'s of each diversity group.
     
    So my goal is that for example that in the first bar the segments should appear as "0.9, 1.0, 1.2,1.7,1.9", while each diversity in the other visuals will re-arrange the Legend segments in the same way (Lowest value to Highest value)..So the legend groups may very well appear in different orders (in each of the diversity visuals).
    • amitchandak's avatar
      amitchandak
      Super User

      F_Reh , We have got new option in the Stacked visual 
      Under Bar/Column - Sort By Value (That will sort the legend by measure)