Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Sorting in stacked bar chart is NOT consistent based on different Measure selected

Hi All,

 

I have 2 different Measure to sort the Stacked Bar Chart.

 

Measure 1 = 

var _FYyear = SELECTEDVALUE(YEAR)
return
CALCULATE(
                  ( SUM(Column1) - SUM(Column 2 ) , FILTER (if condition is written))
)
 
Measure 2 = CALCULATE (SUM(Column1) - SUM(Column 2 ) )

 

When using Measure 2 in Stacked Bar chart,  sorting can be done using chart functionality descensing order.

but the chart is NOT sorted in descending order using Measure 1 .

 

Why is this the case ? Kindly suggest. Thanks a lot

 

  • Hi Anonymous ,

     

    As tested here,in clustered bar chart,it cant be sorted by value,so I suppose it should be just a coincidence for measure 2 to be sorted after calculation:

    For clustered bar chart,there is no selection for the visual to be ordered by a required order.

    Here,I will show you a workaround.

    Create a calculated column to rank the value:

     

    Column 2 = RANKX('Table','Table'[Consumption]-'Table'[Index],'Table'[Consumption]-'Table'[Index],DESC)

     

    Then put the column in the X- axis and choose "Expand all down one level in the hierararchy"

    Then you will see:

    For the related .pbix file,pls click here.

     

    Best Regards,
    Kelly
    Did I answer your question? Mark my post as a solution!
     

     

3 Replies

  • Seems Stange, can you share the screenshot. If possible share pbix after removing sensitive data

    • Anonymous's avatar
      Anonymous
      Not applicable

      amitchandak : Screenshot attached. Removed all the sensitive info from the chart.  These are 2 different Measure. 

       

       

  • v-kelly-msft's avatar
    v-kelly-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    As tested here,in clustered bar chart,it cant be sorted by value,so I suppose it should be just a coincidence for measure 2 to be sorted after calculation:

    For clustered bar chart,there is no selection for the visual to be ordered by a required order.

    Here,I will show you a workaround.

    Create a calculated column to rank the value:

     

    Column 2 = RANKX('Table','Table'[Consumption]-'Table'[Index],'Table'[Consumption]-'Table'[Index],DESC)

     

    Then put the column in the X- axis and choose "Expand all down one level in the hierararchy"

    Then you will see:

    For the related .pbix file,pls click here.

     

    Best Regards,
    Kelly
    Did I answer your question? Mark my post as a solution!