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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
suvechha_b
Creator III
Creator III

Sort the pie - by age range ?

Hi All ,

I have DOB field and I am calculating the age and age range from it like this -

=IF(
AgeCalc<=25,
'18 - 25',
IF(
AgeCalc<=35,
'26 - 35',
IF(
AgeCalc<=45,
'36 - 45',
IF(
AgeCalc<=55,
'46 - 55',
IF(
AgeCalc<=64,
'56 - 65',
IF(
AgeCalc<=74,
'66 - 74',
IF(
IsNull(AgeCalc),
'Unknown',
IF(
AgeCalc>=75,
'75 Plus'
)
)
)
)
)
)
)

)

 

How can I sort the age range at 18-25 is coming at botton.

 

Sort.PNG

 

Sort1.PNG

1 Solution

Accepted Solutions
sunny_talwar

May be try this

=IF(AgeCalc <= 25, Dual('18 - 25', 1),
 IF(AgeCalc <= 35, Dual('26 - 35', 2),
 IF(AgeCalc <= 45, Dual('36 - 45', 3),
 IF(AgeCalc <= 55, Dual('46 - 55', 4),
 IF(AgeCalc <= 64, Dual('56 - 65', 5),
 IF(AgeCalc <= 74, Dual('66 - 74', 6),
 IF(IsNull(AgeCalc), Dual('Unknown', 7),
 IF(AgeCalc >= 75, Dual('75 Plus', 8)))))))))

Change the last two duals if Unknow needs to be the last one

View solution in original post

1 Reply
sunny_talwar

May be try this

=IF(AgeCalc <= 25, Dual('18 - 25', 1),
 IF(AgeCalc <= 35, Dual('26 - 35', 2),
 IF(AgeCalc <= 45, Dual('36 - 45', 3),
 IF(AgeCalc <= 55, Dual('46 - 55', 4),
 IF(AgeCalc <= 64, Dual('56 - 65', 5),
 IF(AgeCalc <= 74, Dual('66 - 74', 6),
 IF(IsNull(AgeCalc), Dual('Unknown', 7),
 IF(AgeCalc >= 75, Dual('75 Plus', 8)))))))))

Change the last two duals if Unknow needs to be the last one