Calculating Age at a Set Date in the Past


#1

I have two fields, one with the person’s birthdate and the other with a service date. How can I calculate their age (in years) on that service date?

(Total newbie here, so I appreciate any advice. Thanks in advance!)


#2

Taking the formula equivalent of the age( function which calculates a person’s age as of today, we can substitute the service date for today() and be able to get the exact age as of that date. This formula assumes the two fields are named Birthdate and Service Date:

yearvalue(«Service Date») - yearvalue(«Birthdate») -
	?(monthvalue(«Birthdate») > monthvalue(«Service Date») or
	monthvalue(«Birthdate»)=monthvalue(«Service Date») and
	dayvalue(«Birthdate») > dayvalue(«Service Date»),1,0)

#3

I think you’re looking for the ‘yearsbetween’ function, eg:

<ageAtService>=yearsbetween(<birthdate>, <servicedate>)

#4

Bill’s answer is much shorter than mine. I forgot about the yearsbetween( function so I think I may have way too many years between.:confounded:


#5

Thank you! The yearsbetween( function worked! :smiley: That function is not listed in the Panorama X online guide I’ve been using:

Is there somewhere else I should be looking for this stuff?


#6

The best place to start is the Panorama Help file you will find under the Help menu. You can search for items by name or optionally with the full text search. If I enter “age” I will get the age( function at the top of the search return list. Looking at that function you will see the yearsbetween( function listed at the bottom of the page in the See Also section (a step I failed to follow when I originally answered you question).