Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Custom Sort for a bar chart

Hello

I am making a bar chart which deals with the ages of people

the original format is

1  -   2  -   3  -   4  -   5

With which I made a master item Dimension where it changed to

Under 16  -   16  -   17  -   18  -   Over 18

When I try to sort the bar chart it changes to

16  -   17  -   18  -   Over 18  -   Under 16

Is there a way to use an expression to set the order in which it is sorted

I would like it to be sorted as

Under 16  -   16  -   17  -   18  -   Over 18

The format is how it is viewed on the X axis of the chart

Any help would be appreciated

Thank you

Labels (1)
4 Replies
Frank_Hartmann
Master II
Master II

if(Dual('Under 16',1),if(Dual('16',2),if(Dual('17',3),if(Dual('18',4),5))))

ahaahaaha
Partner - Master
Partner - Master

Hi,

If preserved in the data  original format is 1  -   2  -   3  -   4  -   5, try sorted on it for dimension Under 16  -   16  -   17  -   18  -   Over 18.

Anonymous
Not applicable
Author

Hello

Im using Qlik Sense

Where exactly would that expression be put in

Frank_Hartmann
Master II
Master II

see attached files script and sorting expression in barchart

hope this helps