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: 
sunil-kumar5
Creator II
Creator II

Using If condition for Age however not getting result.

Hi Community,

I am actually trying to get the age range however only getting result for "50 Plus"

First I added "date((date(today(),'DD/MM/YYYY')-date([DATE_OF_BIRTH],'DD/MM/YYYY')),'YY') as Age," in EE.Mast table and get the Year of age for each candidate.

Then, I applied age range per below and load new table as EMS:

EMS:
Load EMP_CODE,EE.Mast.Age,

If(EE.Mast.Age>10 and EE.Mast.Age<18,'<18',
If(EE.Mast.Age>=18 and EE.Mast.Age<25,'18-25',
If(EE.Mast.Age>=25 and EE.Mast.Age<30,'25-30',
If(EE.Mast.Age>=30 and EE.Mast.Age<40,'30-40',
If(EE.Mast.Age>=40 and EE.Mast.Age<=50,'40-50','Plus 50'))))) as Age_Years Resident EE.Mast;

After loading the data I am only getting "Plus 50" for all records.

Any help in this appreciated:-)

Thanks

 

 

1 Solution

Accepted Solutions
tm_burgers
Creator III
Creator III

There is a built in script function for Age

 

Age(today(),[DATE_OF_BIRTH]) as Age

 

Otherwise I cannot see any errors. 

View solution in original post

2 Replies
tm_burgers
Creator III
Creator III

There is a built in script function for Age

 

Age(today(),[DATE_OF_BIRTH]) as Age

 

Otherwise I cannot see any errors. 

sunil-kumar5
Creator II
Creator II
Author

Thanks for your help!! Tm_burgers 

Its working absolutely fine.