Forum Discussion

manojk_pbi's avatar
manojk_pbi
Icon for Helper V rankHelper V
2 years ago

help need in Sorting Stacked Bar charts

Hi Friends,

 

I am looking for a suggestion on adding sort in Stacked bar charts on Legends. Please suggest how this can be achieved. I don't see any option which sorts my data using legends. Attached the sample data on which i tried and also picture how it looks 

my expectation is - chart should be sorted with Type 1  and it's share by desc

Prod 6 

Prod 3

prod 8

Prod 4

Prod 1

prod 2

 

sample :

ProdActualType
prod11757.00Type1
prod12202.00Type2
Prod2244.00Type1
Prod2328.00Type2
Prod32145.00Type1
Prod3458.00Type2
Prod4164.00Type1
Prod4159.00Type2
Prod5206.00Type1
Prod51047.00Type2
Prod63010.00Type1
Prod6133.00Type2
Prod7931.00Type2
Prod8877.00Type1
Prod8592.00Type2

 

 

6 Replies

  • In the regular world a column can only be sorted by itself or by another column, not by a measure.  ( Ashish_Mathur may know a trick using visual type switching )

     

    Even a DAX column will result in a circular reference, so you would need to create that sort column in Power Query.

     

    This of course no longer makes it dynamic.  But it produces the desired result.

     

     

     

     

     

    • manojk_pbi's avatar
      manojk_pbi
      Icon for Helper V rankHelper V

      Thanks lbendlin for your reply. I will try it on my data set. I am just wondering about performance of this query on data when we have large data. Data which i had provided is aggregated and sample.