cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
newgirlflow
Helper II
Helper II

Column for Date Today

Hi, everyone!

 

In my SharePoint document library where they upload contracts, I created additional columns for them to input other contract details such as Start Date, Expiry Date, etc. I wanted to put an Aging column, so that is computed as Date Today less Expiry Date.

 

I added a "Date Today" column and what I understood from reading other articles is that a flow is needed to update this column daily. So I made this flow like below.

today1.JPGtoday3.JPGtoday4.JPGtoday5.JPG

 

 

However, when I scroll through my library, not all of the rows for the "Date Today" column were updated. Anybody who has an idea why this is? And what modifications I should do with the flow?

 

today2.JPG

5 REPLIES 5
ekarim2020
Super User
Super User

I had to do something similar a while back. I needed to calculate the age based on the date of birth column:

ekarim2020_0-1629232827227.png

The way this was achieved was using JSON formatting applied the AGE field which allows the age to auto update:

ekarim2020_1-1629232930456.png

ekarim2020_2-1629233046164.png

This was the JSON code I used (based on Create an 'Age/Days old' column in SharePoint List😞

ekarim2020_3-1629233091722.png

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "=substring(toString(Number(@now-@currentField)/86400000/365),0,indexOf(toString(Number(@now-@currentField)/86400000/365),'.')+2)"
}

To learn more see Use view formatting to customize SharePoint

Hope this helps.

Ellis

Hi @ekarim2020 

Thanks for the reply!

 

Let me know if I understood it right. I will create a new column of Date/Time and then input JSON formatting in it like below?

 

If so, how do I reference the "Expiry Date" column in the column to compute the aging? Basically, I would like to compute =TODAY less "Expiry Date". Sorry, I'm not experienced with JSON.

 

aging.JPGaging2.JPGaging3.JPG

 

ekarim2020
Super User
Super User

My experience with JSON formatting is very limited, but I was able to implement the Age field based on the two articles I have linked to in my previous post.

If you are able to get a calculate age formula to working as the first step, then it should be a matter of modifying that working code to give you the Aging data.

Ellis

Hi @ekarim2020 ! After reading the links multiple times, I got it now! I applied it in a Date column and format it to show as a number aging. However, I tried downloading the list as Excel and the column would show as date instead o of a number. I guess that's the trade-off. Anyway, thanks for this tip!

 

Too bad I didn't get a response on why the simple updating of 'Date Today' column wasn't being applied to all rows. 

ekarim2020
Super User
Super User

See: A collection of SharePoint List Formatting Samples

https://github.com/pnp/List-Formatting

Ellis

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (2,810)