Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Line and stacked column chart - Sort column legend

Hi thank you for reading!

 

I'm working on a survey data with a 6-point satisfaction rating scale: Very Dissatisfied, Dissatisfied, Slightly Dissatisfied, Slightly Satisfied, Satisfied, and Very Satisfied. Within this dataset, there are two years worth of survey data, and I need to visualise my data in 100% stacked column chart, together with the mean score. Please find below the fields used for better understanding:

Shared axis: Year

Column series: Question

Column values: Measure with the following DAX formula

Measure =
VAR Val2AllCats = CALCULATE(COUNTA('All Data'[Question]),ALL('All Data'[Question]))
RETURN
DIVIDE(COUNTA('All Data'[Question]),Val2AllCats)

Line values: Average of Question

 

However, the problem I faced was that I'm not able to sort the legend of the column chart in the order of the satisfaction 6-point rating scale. With all the fields above, I've managed to come up with the chart I wanted. However, the satisfaction levels are arranged in alphabetical order. 

 

I have tried to sort the order of the column chart using relationships and a table to define each satisfaction level and an index column. However, once I sort the satisfaction label by the index, and replaced Column series with "Satisfaction Level", the chart shown changes and I get the following outcome:

 

1 Reply