Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
chrislyonsuk
Contributor
Contributor

Automatic sorting of age band

I'm using an age band as below:

If(age > 0 and age < 20, ('Under 20'),

If(age >= 20 and age < 30, ('20-30'),

If(age >= 30 and age < 40, ('30-40'),

If(age >= 40 and age < 50, ('40-50'),

If(age>= 50 and age < 60, ('50-60'),

If(age >= 60 and age < 70, ('60-70'),

If(age >= 70, ('70 & Over') ))))))) as Age Band

but I wish to automatically sort them so 'Under 20' is first on any list/sheet/table produced and not last. I have tried to use dual() but I cannot get it to work. Any help would be appreciated.

 

Thanks 

 

1 Solution

Accepted Solutions
JuanGerardo
Partner - Specialist
Partner - Specialist

Use a dual field to order a string by a number, for example:

Dual('Under 20', 20)

Dual('40-50', 40)

Etc.

And I would recommend to have a look at the Class() function, maybe is useful for you.

JG

View solution in original post

2 Replies
JuanGerardo
Partner - Specialist
Partner - Specialist

Use a dual field to order a string by a number, for example:

Dual('Under 20', 20)

Dual('40-50', 40)

Etc.

And I would recommend to have a look at the Class() function, maybe is useful for you.

JG

chrislyonsuk
Contributor
Contributor
Author

Brilliant, Thank you