web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Can we able to calcula...
Power Apps
Answered

Can we able to calculate the time period in PowerApps

(0) ShareShare
ReportReport
Posted on by 62

Here we have 68 steps that user or employee supposed to complete for each customer. I would like to find; how much time spend by the employee for each step. For example, employee spend 60 minutes for the step1. it's should calculate and send to their manage. If he completes one step, it will update to next step. And again, it has to calculate the current step age or time spend by the employee or user to complete this step.

Categories:
  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Changal ,

     

    You can create a collection OnVisible of the first screen to record the timestamp when the screen is open:

    ClearCollect(colTimeRecorder, {Start:Now()})

    Then on a button which navigates to another screen, update current record with an end time:

    Patch(colTimeRecorder, Last(colTimeRecorder), {EndStep1: Now()})

    Similarly, record the finish time of step2:

    Patch(colTimeRecorder, Last(colTimeRecorder), {EndStep2: Now()})

     

    At last, you will be able to calculate time consumption of each step.

    Step1:

    DateDiff(First(colTimeRecorder).Start,First(colTimeRecorder).EndStep1,Minutes)

    Step2:

     

    DateDiff(First(colTimeRecorder).EndStep1,First(colTimeRecorder).EndStep2,Minutes)

     

    and so on.

     

    Best regards,

  • Changal Profile Picture
    62 on at

    Hi Jeffer Ni,

     

    Thanks for replying to query, I would like to explain in detail about my requirement to make you understand much better about the problem.  Here is the step number (refer stepumber) it is form, i have mapped the SharePoint List to the form. based on the employees are entering the data in the below form (refer stepno2). I am updating the step number to next using Power Automate. I have added the trigger the flow by using the button (refer ss3). 

    stepnumber.png
    ss3.png
    stepno2.png
  • Changal Profile Picture
    62 on at

    Here i have to find out the time period of each step number. For example, if the current step is step number 5 , the employee taken time from 18.10 PM to 18.40 PM, which means the time period for the step number 5 is 30 minutes. How could we able to achieve this one.

  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Changal ,

     

    Basically, the steps are similar as of my first reply. You can apply the creation of collection OnChange of the Dropdown and save the step number as well.

     

    OnVisible of the screen, clear the collection and generate the first record for step1:

    ClearCollect(colTimeRecorder,{Step: Dropdown.Selected.Value,Start:Now()})

    OnChange of Dropdown

    Patch(colTimeRecorder, Last(colTimeRecorder), {EndStep1: Now()});
    Collect(colTimeRecorder, {Step: Self.Selected.Value,Start:Now()})

    In the end, you will still need a button to save the end time of the last step

    Patch(colTimeRecorder, Last(colTimeRecorder), {EndStep1: Now()})

    So, there will be a collection includes the start and end time of each step, you can use a AddColumns function to get the durations:

    AddColumns(colTimeRecorder, "Duration", DateDiff(ThisRecord.Start,ThisRecord.End,Minutes))

     

    But there is a question now: how you will deal with the situation that users mistakenly select a wrong step? This will mess up the records.

     

    Best regards,

  • Craig_Cowley Profile Picture
    311 on at

    Hi @v-jefferni 

     

    I'm looking to do something similar, but using submit buttons. I want to track the time between when a project is submitted via a button as 'In Progress' to when it is changed to 'Complete' via another button. With the output (work days) as a text box within my main form.

     

    Thanks in advance

     

    Craig

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 190 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard