Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Sort order on axis

Hello,

I am trying to sort the order displayed in the chart I have.  The axis values are currently age groups so for example "-20", "20 - 25", "25 - 30", etc.  If I use the sorting options availaible on the properties I cannot achieve what I would like which is "-20" at the top, etc.

Has anyone got the magic trick?

Thank you

5 Replies
hic
Former Employee
Former Employee

Create your dimension values - the groups - as dual values.

Alt 1: Use the class function, class( age,5 )

Alt 2: Use the dual function, dual(<display text>, <numeric value from the middle of the range>)

Then you can sort your axis numerically. Both functions are described in the help.

/HIC

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Try the sort by expression option in the sort tab with expression as

     =Num(Trim(SubField(AgeGroup,'-',2)))

Celambarasan

Not applicable
Author

Thank you but this has not worked...

Anonymous
Not applicable
Author

You can do this by adding an inline load to your script, something like:

LOAD * INLINE [

    '"Age Group"', Sort

    '"-20"', 1

    '"20-25"', 2

    '"26-30"', 3

    '"30 +"', 4

];

Now you can use the new field (Sort) in a sort by expression.

Not applicable
Author

Thank you all I got it to work!