# New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Highlighted
Valued Contributor III

## four years

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

Tags (2)
1 Solution

Accepted Solutions
MVP

## Re: four years

Age() is there in qlik. Try like:

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

8 Replies
Valued Contributor II

## Re: four years

hello,

something like this

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

'less than 4 years')

Esteemed Contributor

## Re: four years

Hi,

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

Valued Contributor III

## Re: four years

My date field is

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

yes its based on today date

MVP

## Re: four years

Age() is there in qlik. Try like:

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

Honored Contributor III

## Re: four years

Esteemed Contributor

## Re: four years

Valued Contributor III

## Re: four years

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

## Re: four years

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,