Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreShape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.
How do I calculate total time between start time and stop time when my data is like this?
Solved! Go to Solution.
Once you examined the code, replace the Source step with your own source.
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.
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?
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-...
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/1447...
The start and stop time for each day of each person is not always on the same row, I don't know how to get the total hrs for that person each day. How do I attach sample pbix file here?
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-...
Still need help please!
Apologies, cannot work off screenshots.
hope this works for you https://drive.google.com/file/d/1qTDip455X-M_SefingPvcL7gOaqr__4g/view?usp=drive_link
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("rZZdT8IwFIb/SsO1if0a7XqnXGmCYvDOeDFHBeLYTLeR+O8tiNKVdh5lhIvmNHmf09Nz9vbpaYRm2tRVia5GFyNyKS8pptxZorEiqcIYXU2jUfuf5yu9aAu9sOtH0+ZvaJqty0aXWZnr0fPF7xyqMN0pzg6K4Y2/ctIj52uJhMLMOU8outfOtrpYl0u7vjcLbRC2PzmWFASRinbK42V+p19MVr9l6LZ6AeoxPKwel57eTYlmploaXdf/O3OqGPc0z6wioYcyzo6Sk2rzXuhmf+z/SfK022bBHbe6R8xYMBLAEHLkHNZ2QBh12iwYjnKkEAmQQ7Dinc6NbUXvl0sWYlGHRb+Tx4l7plDYO9MkK+wCWdlJWzfVxiKAMKHYuKfl3bsXKVgzSTzNSD/BiyK9G/XyJHWDHtrMNFZ5rs12nWs01brZDQUY4M+qC6Dl4mwAJz0AZgYA+CXq6UYOV/Uv002bN6sz0ybktAUjXzR41tZoSPf7E9yJtmWXcx0x08TtmXDUH9TKNmr1iuZZoWsQw35eiIBNqKAEJElPihPagL8BriMuwBXHp2+ATjR+1+HDnELsEwnssVBNqRJ/VM/M0t4i9tOMNB9YkqoExzzW2QF67BeGYGeW8M+AJu7b9G/xqPWKED5shyxshyw6ZR95odGkassGCLE2CBwy3wbjmgNZVi9gCMvqAwxiWb2AjrlEdsCG8/wJ", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Resource = _t, #"Created On (PST)" = _t, #"TimeStamp (PST)" = _t, Start = _t, Stop = _t, #"Booking Status" = _t, Description = _t]),
#"Replaced Value" = Table.ReplaceValue(Source,"",null,Replacer.ReplaceValue,{"Start"}),
#"Filled Down" = Table.FillDown(#"Replaced Value",{"Start"}),
#"Grouped Rows" = Table.Group(#"Filled Down", {"Resource", "Start"}, {{"Stop", each List.Max([Stop]), type nullable text}}),
#"Changed Type" = Table.TransformColumnTypes(#"Grouped Rows",{{"Start", type datetime}, {"Stop", type datetime}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Duration", each [Stop]-[Start], type duration)
in
#"Added Custom"
How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the Source step with your own source.
how do use your code but applying it to my real data source connecting to Dynamics?
Once you examined the code, replace the Source step with your own source.
it's frustrating... I can't share the file in onedrive because of security permission. I tried to insert to table and got error message ""Your post has been changed because invalid HTML was found in the message body. The invalid HTML has been removed. Please review the message and submit the message when you are satisfied." Can you work with this small data set? Thanks in advance.
Still need help please!
User | Count |
---|---|
92 | |
88 | |
88 | |
82 | |
49 |
User | Count |
---|---|
156 | |
145 | |
104 | |
72 | |
55 |