Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
YH_IKONS
Contributor II
Contributor II

Sorting a Legend by Expression

Good Day

I have a table which correlates the table of ages in its correct order. I have sorted the graph by expression which sorts out the data values correctly as shown below ('Age > 182' is shown as the bottom stack in the bar graph) however, the legend shows this value as second. Is there a way to sort out the legend?

YH_IKONS_0-1678269104077.png

 

Thank You
Regards
Daanyaal

Labels (1)
2 Replies
BenjaminT
Partner - Creator
Partner - Creator

Hi Daanyaal,

Have you tried using the dual() function to assign a numeric sort value to each age bucket alongside the string of text? 

https://help.qlik.com/en-US/sense/February2023/Subsystems/Hub/Content/Sense_Hub/Scripting/Formatting...

 

YH_IKONS
Contributor II
Contributor II
Author

Yes, I have a table  with two collumns. One column has the age buckets and the other has its required order (1, 2, 3 and so on called "Age sequence"). I have sorted the age buckets according to the Age sequence which has ordered the stacks of the bar chart correctly however the legend is still being sorted incorrectly.