on 2024 Jun 30 5:16 PM
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.
Request clarification before answering.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
7 | |
6 | |
5 | |
4 | |
2 | |
2 | |
2 | |
2 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.