Discussion board where members can get started with QlikView.
Hi all I want to calculate the age of less than 4years and greater than 4yeras like attached how to calculate
Go to Solution.
Age() is there in qlik. Try like:
If(Age(today(), yourdate)>=4, '>= four', '< four')
View solution in original post
something like this
if(Today()-MyDate>365*4-1,'gt than 4 years',
'less than 4 years')
tell us more about your data structure? what is your date field type ?
do you calculate the age from a range of dates or you are comparing with today date ?
My date field is
started_on = 10/26/2016 2:07:02 AM
yes its based on today date
=Date(Addyears(Date#('10/26/2016 2:07:02 AM','MM/DD/YYYY h:mm:ss TT'),4))>Today()
=if(Date(started_on)-AddYears(Timestamp(today()),-1)<1460,'less tha...','greater than..')
done change in expression this is also working
-Date(Floor(Num([My_date])),'DD-MM-YYYY'))/365)>4,'Greater than 4 years','Lesser than 4 years') as by_Age,
I see few unnecessary (majorly formatting) functions, you can get rid of. The equivalent would be:
if((Today()-[My_date])/365>4,'Greater than 4 years','Lesser than 4 years') as by_Age,