Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

PA flow to track length in a project phase based on a field changes

(0) ShareShare
ReportReport
Posted on by 15

Hi all,

i am looking for help/support  to solve my requirement and it is:

To be able to track a length in project phase which follows with following stages:

    • Preparation
    • Specification
    • Implementation
    • Closure

Where i would like to track the duration of how many days the project occurred in a particular stage. My custom list contains lots of fields and one of them is called „Project phase“, containing drop down list of the above mentioned stages. I am interested in date when i entered the particular stage and when exited, this is based only on the filed “ Project Phase” change with no additional fields containing date. This would have to be taken out of the history data/versions?

 

Is there any chance to track the length and record the duration time in other list which will contain e.g.:

Project name ‖ project phase ‖ duration in days -  where for each project will be there several lines or anyone have better solution?

  • David_MA Profile Picture
    11,517 Super User 2025 Season 1 on at
    Re: PA flow to track length in a project phase based on a field changes

    If you don't want to add more fields to your existing list, I would suggest the following:

    1. Create one flow that runs when the item is created, which then creates the initial item in your secondary list for tracking the dates of the stages. Be sure to add an integer column to populate it with the ID of the original item to ensure the ID of the two list are not out of sync.
    2. Create a second flow that runs only when the item is modified. You will then use the get versions action and check of the stage value has changed.
      1. If it has, you can use a switch to direct the flow to the actions for that stage to set a corresponding date field to the modified date of the original list item.
      2. If the stage wasn't modified, the flow ends.
      3. You can use ticks to calculate the number of days between the two dates in the stages. This post will provide guidance: How to find the number of days between two dates u... - Power Platform Community (microsoft.com)
      4. An easier method if you only need to see the days in the SharePoint view would be to use JSON list formatting to calculate then number of dates between two stages. You would apply the following to the date field and update $EndDate with the other date field. For example, to find the days between Preparation and Specification, you would add the code to the Specification date field and set $EndDate to the internal name of the Preparation 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(@currentField) - Number([$EndDate])) / (86400000)) + ' days)')",
     "style": {
     "border": "none",
     "background-color": "transparent",
     "cursor": "pointer"
     }
    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492