Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Age Function

Hey There,

i use on my data model at the age function & Interval for some reason i get not the right age, any idea what im doing wrong ?

On sql servel i use this "DATEDIFF(Year,E.BirthDate,GetDate()) EmployeeAge" but i know datediff does not work on qv so i try this other method.

Regards

David

Capture.JPG

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Interval() is a formatting function, like Date() or Timestamp().

Age() calculates age.

View solution in original post

12 Replies
swuehl
MVP
MVP

Isn't the right age 39?

Anonymous
Not applicable
Author

Look at the Interval

sunny_talwar

I agree the age will be 40 on May 15th, isn't it?

swuehl
MVP
MVP

The interval is showing a rounded number, right? So basically a rough estimation how many years have passed between dates. But that's not "age" as I would define it (which is more like a floor'ed number).

sunny_talwar

I got 39, when I put this in a text box object

=Interval((Today() - MakeDate(1976, 5, 15))/365, 'D')

swuehl
MVP
MVP

Maybe you can explain what you want to calculate? The age of a person? Then use the age() function.

Anonymous
Not applicable
Author

I try To understand the diff between Interval Vs Age() 

swuehl
MVP
MVP

Interval() is a formatting function, like Date() or Timestamp().

Age() calculates age.

lawrenceiow
Creator II
Creator II

Do you happen to know the accuracy of the Age() function?

Apologies for asking this in this post, please let me know if I should start a new post.

I always used to calculate age by dividing the days number by 365.25 as 365 was not accurate enough. Then, someone pointed out to me that Pope Gregory XIII had pointed out that Julius Caesar was incorrect in suggesting a year was 365.25 days long, it should be 365.2425. Hence the change from the Julian Calendar to the Gregorian Calendar.

So, do you happen to know how accurate Qlikview's Age() function is, the help screen does not specify?