Forum Discussion
jensjakobsen1966
Jan 27, 2022Brass Contributor
Date calculation on SharePoint lists between today and a birthdate
Hi I've tried to calculate the age of a person based on 2 columns (NO success at all) on a SharePoint list. Therefore I need help, from the ground: Birthday column is a DATE column Today's ...
- Jan 27, 2022
jensjakobsen1966 there are a couple of ways to do this. One is with a flow in Power Automate that runs once a day and does the calculation. Another is to have a number column and format it with JSON as follows:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "txtContent": "=floor((Number(@now)-Number([$Birthday]))/(1000*60*60*24*12)/365*12)" }
The result is:
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
RobElliott
Jan 27, 2022Silver Contributor
jensjakobsen1966 there are a couple of ways to do this. One is with a flow in Power Automate that runs once a day and does the calculation. Another is to have a number column and format it with JSON as follows:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=floor((Number(@now)-Number([$Birthday]))/(1000*60*60*24*12)/365*12)"
}
The result is:
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)
- Bo_Li_ChengJan 10, 2023Copper Contributor
RobElliott
I used the exact same thing but every result returned 53. Are there some other settings I may have missed?- Edolop67May 10, 2023Copper Contributor
- jinibobAug 09, 2022Copper ContributorHi,
How do you do this using PowerAutomate? - jensjakobsen1966Jan 27, 2022Brass ContributorSuch a beautiful solution - THANK YOU!
🙂- jensjakobsen1966Jan 27, 2022Brass Contributor
Hi again RobElliott - I believe there's an error. And I'm sorry to bother you again.
Whenever a person has his/hers birthday within January to July, the formula will round up the age, even though the person has not yet had their birthday.- RobElliottJan 29, 2022Silver Contributor
jensjakobsen1966 that's strange and I can't reproduce it; as you can see from the image below, there is no incorrect rounding of the ages on my list:
Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)