# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Action-Packed Learning Awaits! QlikWorld 2023. April 17 - 20 in Las Vegas: REGISTER NOW
cancel
Showing results for
Did you mean:
Master

## four years

Hi all I want to calculate the age of less than 4years and  greater than 4yeras like attached how to calculate

1 Solution

Accepted Solutions
MVP

Age() is there in qlik. Try like:

If(Age(today(), yourdate)>=4, '>= four', '< four')

8 Replies
Specialist III

hello,

something like this

if(Today()-MyDate>365*4-1,'gt than 4 years',

'less than 4 years')

Champion

Hi,

do you calculate the age from a range of dates or you are comparing with today date ?

Master
Author

My date field is

started_on    = 10/26/2016 2:07:02 AM

yes its based on today date

MVP

Age() is there in qlik. Try like:

If(Age(today(), yourdate)>=4, '>= four', '< four')

Master III

Champion

Master
Author

done change in expression this is also working

if(((Date(Today(),'DD-MM-YYYY')

-Date(Floor(Num([My_date])),'DD-MM-YYYY'))/365)>4,'Greater than 4 years','Lesser than 4 years') as by_Age,

MVP

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,

Community Browser