Hi All
in the sharepoint list for work anniversay year [ No of years ] should be manually maintained or is there any calculation for this feild

Hi All
in the sharepoint list for work anniversay year [ No of years ] should be manually maintained or is there any calculation for this feild
Your question isn't really about Power Automate, but I can give you a solution. You can use JSON formatting of your SharePoint list. You can use this JSON code to return the number of years for a date field.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"txtContent": "=if(Number(@currentField) == 0, 'N/A', '@currentField.displayValue' + ' (' + floor((Number(@now) - Number(@currentField)) / (31536000000)) + ' years)')",
"style": {
"border": "none",
"background-color": "transparent",
"cursor": "pointer"
}
}
You cannot use a calculated column, because the calculation is only refreshed when the item is updated. With JSON, it automatically calculates in the view. Here is resource for learning how to format SharePoint views with JSON: Use view formatting to customize SharePoint | Microsoft Learn
The above will return:
If someone can figure out how to adjust it to one decimal point, I would appreciate that. I have had no luck so far. But this should work for your use case around work anniversaries.