cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sudosaurus
Post Prodigy
Post Prodigy

Flow instead of calculated column?

I have two calculated columns. One named “DaysRemaining” and the other named “DaysPending”.

DaysRemaining uses this formula: =TEXT([Workflow Timeout]-TODAY(),"D")

DaysPending uses this formula: =TEXT([Workflow Timeout]-Created,"D")

Essentially the Days Remaining column should show the amount of days left for an item before its Power Automate workflow times out (30 days) and Days Pending should show the amount of days the item has been in a pending state for – however these are showing data that is wildly not accurate.

 

sudosaurus_0-1652714685540.png

 

Can I achieve updating this with a Power Automate flow? If someone could help me with an example that would be really helpful.

 

Thanks,

Chris

2 REPLIES 2
ScottShearer
Super User
Super User

@sudosaurus 

In power automate, there is no single expression that allows you find the difference in days bewteen two dates.  Rather, you need to do the following:

  1. Use the ticks() expression to convert your dates to ticks
  2. Subtract one value in ticks from the other to find the difference in ticks
  3. Divide the result by the number of ticks in a day

Here is an example that show you exactly how to do this.

Let me know if you need more help.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
tom_riha
Super User
Super User

Hello @sudosaurus ,

I don't think having a flow that would recalculate the values and update each item every day is a good solution. What about using JSON formatting on the column to calculate the dates? The JSON formatting will recalculate the date with each refresh of the page, unlike the calculated column that recalculates them only when the item is updated.

The only thing to be careful about the JSON solution is that it's user-side solution - the number will not be stored in the list, it'll be only visible to the users.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Helpful resources

Announcements
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (3,375)