Sorting a Stacked Barchart

I am trying to sort the my chart so that the Red (disagree) is on the far left, then gray, then light to dark green.  Does anyone know how to do this?  On normal charts I can add a hidden sort dimension, but this situation won’t let me do that. 

95f4355f-7b6f-4eaf-98c3-ddb7da672c0f.png
0 1 175
1 REPLY 1

Dawid
Participant V

Hi Benjamin,

Yes, it’s possible. For categorical values that are often used as pivots, I create an order field in LookML:

dimension: recommend_choice_order {
type: number
hidden: yes
sql: CASE
WHEN ${recommend_choice} = 'Disagree' THEN 1
WHEN ....... THEN 2
ELSE 8
END ;;
}

And then use parameter order_by_field in your categorical dimension:

dimension: recommend_choice {
order_by_field: recommend_choice_order
}
Top Labels in this Space
Top Solution Authors