Forum Discussion

tracyhopaulson's avatar
tracyhopaulson
Icon for Resolver I rankResolver I
2 years ago
Solved

Calculate Time

How do I calculate total time between start time and stop time when my data is like this?

 

  • lbendlin's avatar
    lbendlin
    2 years ago

    Once you examined the code, replace the Source step with your own source.

13 Replies

  • does one event always finish before the other starts?  No overlaps?

     

    Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

    Do not include sensitive information or anything not related to the issue or question.

    If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216

    Please show the expected outcome based on the sample data you provided.

    Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi tracyhopaulson ,

     

    According to your description, here are my steps you can follow as a solution.

    (1) My test data is the same as yours.

    (2) We can create two slicer tables.

    Start Time Slicer = VALUES('Table'[TimeStamp(PST)])
    Stop Time Slicer = VALUES('Table'[TimeStamp(PST)])

    (3) We can create a measure.

    Time = DATEDIFF(MAX('Start Time Slicer'[TimeStamp(PST)]),MAX('Stop Time Slicer'[TimeStamp(PST)]),MINUTE)

    (4) Then the result is as follows.

     

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

    If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

    • tracyhopaulson's avatar
      tracyhopaulson
      Icon for Resolver I rankResolver I

      Thank you for your feedback.  Is it possible to have the measure calculate the total minutes from start to stop for each day without the slicers?