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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
kmswetha
Creator
Creator

Age classifications

Hi,

Struck with the below aging bucket.

I have to classify <=30 ,>30,31-60

its a simple if is not going to multiple loops.

if(age<=30,'less than 30',

if(age>30,'greater than 30',

if(age>30 and age <60,'between 30 and 60')))

Problem here is once age goes to age>30, it doesn't go the next if.

How to deal this situation?

Any suggestions?

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You would need to create a table with multiple records for the same age, assigning different classes (Like a link table).

LOAD

     age,

     if(age<=30,'less than 30','greater than 30') as Class

FROM ...

CONCATENATE

LOAD

     age,

   'between 30 and 60' as Class

FROM ...

WHERE age > 30 and age <60;

edit: corrected second load

View solution in original post

5 Replies
sunny_talwar

Why do you assign two text to single value? If a Age = 45 you want it to be called greater than 30 and between 30 and 60 at the same time?

Chanty4u
MVP
MVP

try this

if(age<=30,'less than 30', A1,

if(age>30,'greater than 30',A2

if(age>30 and age <60,'between 30 and 60' )))as A3

try to create in backend script and u will get flags in front end.

swuehl
MVP
MVP

You would need to create a table with multiple records for the same age, assigning different classes (Like a link table).

LOAD

     age,

     if(age<=30,'less than 30','greater than 30') as Class

FROM ...

CONCATENATE

LOAD

     age,

   'between 30 and 60' as Class

FROM ...

WHERE age > 30 and age <60;

edit: corrected second load

Colin-Albert
Partner - Champion
Partner - Champion

QlikView has a function class() that can group data into equal size bands in a simple command.

For different size bands then you will need to use if statements.

Just remember to make your column wide enough to see the results

Class function

kmswetha
Creator
Creator
Author

I was also thinking same. Let me try and reply back to this post.

Thank Swuehl