cancel
Showing results for 
Search instead for 
Did you mean: 

Story Report - Get employee's age in years and months

vickyjain9181
Explorer
0 Kudos
702

Hi, How do I define a calculated field to get employee's age in years and months?  I can get the years using the below formula but I am unable to get the integer part/number part of the decimal value.  Can you please help?

Age in Decimals = DAYS_BETWEEN (CURRENT DATE, DATE OF BIRTH) / 365

I tried ROUND but it is rounding and not giving me the integer part. TOINETGER function only takes string as a parameter.  I tried TOINTEGER (TOTEXT(Decimal value)) but that didn't work either.

Can you please help ?

 

Thanks,

Vicky.

View Entire Topic
JackNoone94
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi @vickyjain9181,

Due to the restrictions in calculations that we have with Story Reports. Generally, we would suggest the following:

ROUND(DAYS_BETWEEN([date of Birth],CURRENTDATE())/365,0)

https://me.sap.com/notes/3256363/E 

However, using this formula in Stories produces pretty accurate results, but not flawless. Dividing by the average number of days in a year works fine most of the time, but sometimes it gets the age wrong. For example, if someone was born on February 29 and today is February 28, the formula will make a person one day older.

As an alternative, you can divide by 365.25 instead of 365 since every fourth year has 366 days. However, this approach is not perfect either. For example, if you are calculating the age of a child who hasn't yet lived through a leap year, dividing by 365.25 produces a wrong result.

Overall, subtracting the birth date from the current date works great in normal life, but is not the ideal approach in Stories and it is kind of a technology challenge with the tool. 

Thanks,

Jack

Nagavalli_BN
Explorer
0 Kudos
We should raise a customer influence to get the required result. Same requirement we also have. However, we are able to cater only half of it. The age is getting calculated accurately. But it cannot display in Years and Months format. It will give in decimal only.