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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
stevelord
Specialist
Specialist

Any easy formula/expression for computing age in years with dateofbirth field?

Hi, Is there a simple formula/expression for computing age in years if you have a dateofbirth field provided?

I gave a colleague a simple dual if statement about if dateofbirth>=, < 365.25*18 days to make a yes/no field about person being 18, but it might miss by a fraction of a day or something and wondering if we have something silly like an aghe(dateofbirth) function laying around.   (Note the sentence was not the actual dual statement, I just typed it out phoenetically here. )

Labels (1)
1 Solution

Accepted Solutions
martinpohl
Partner - Master
Partner - Master

How about the age function?

it calculates the age:

age(today(),date) as age

Regards

View solution in original post

3 Replies
eespiritu
Creator
Creator

Try this: 

=year(now()) - year(dateofbirth)

Enrique

martinpohl
Partner - Master
Partner - Master

How about the age function?

it calculates the age:

age(today(),date) as age

Regards

stevelord
Specialist
Specialist
Author

Thanks, next time I'll just try typing the obvious in script and see if autofill suggests the function for me.  I told my colleague before posting here, 'I'll check on qlikcommunity in case there's something silly easy like age()'.. Completely unexpected.

I tested in a textbox for myself, with today's date and a birthday earlier and later than today, and it worked fine.