Desktop productivity for business analysts and programmers

Calculate Age from Transaction Date

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 104
Accepted Solution

Calculate Age from Transaction Date

I looked through all the treads about  calculating age  and found  this line of code:

int(YRDIF(t1.DOB, t1.PlayerDayDate, 'Year'))

The line of code is valid but the column ,AGE, shows missing value or no values. What did I do wrong?

My DOB and PlayerDayDate format are as follow:

22MAR2014:00:00:00


Accepted Solutions
Solution
‎03-30-2015 04:50 PM
Grand Advisor
Posts: 10,211

Re: Calculate Age from Transaction Date

The variables have to be DATE valued functions, not DATETIME. Use datepart(t1.dob) and datepart(t1.PlayerDayDate).

I think you want "AGE" as the basis or blank, 'YEAR' should have gotten a warning or error message.

View solution in original post


All Replies
Solution
‎03-30-2015 04:50 PM
Grand Advisor
Posts: 10,211

Re: Calculate Age from Transaction Date

The variables have to be DATE valued functions, not DATETIME. Use datepart(t1.dob) and datepart(t1.PlayerDayDate).

I think you want "AGE" as the basis or blank, 'YEAR' should have gotten a warning or error message.

Frequent Contributor
Posts: 104

Re: Calculate Age from Transaction Date

Thank you, it worked!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 270 views
  • 0 likes
  • 2 in conversation