Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply

Need help with the time calculation measure

Hello everyone,

I need help with calculating time difference by each task.

 

I have a below table
taskid   submittedby    starttime                                   endtime                                       state

1            dave               Thu, 02 Mar 2023 18:28:17     Thu, 02 Mar 2023 18:28:21           progress

1            dave               Thu, 02 Mar 2023 18:28:21     Thu, 02 Mar 2023 18:28:35           progress

1            dave               Thu, 02 Mar 2023 18:28:35     Thu, 02 Mar 2023 18:28:43           progress

1            dave               Thu, 02 Mar 2023 18:28:06     Thu, 02 Mar 2023 18:28:06           pending

2            roy                 Thu, 02 Mar 2023 18:38:21     Thu, 02 Mar 2023 18:39:35           progress

2            roy                 Thu, 02 Mar 2023 18:38:21     Thu, 02 Mar 2023 18:39:35           progress

2            roy                 Thu, 02 Mar 2023 18:38:35     Thu, 02 Mar 2023 18:39:43           progress

2            roy                 Thu, 02 Mar 2023 18:38:06     Thu, 02 Mar 2023 18:398:06         pending

 

I want to display by each task, how long for user to take from pending to progress. I want to display minus minimum pending to minus minimu progress time and how can I achive this by each task by using measure? 

3 REPLIES 3

Its not giving me correct result. Let me rephrase the quesiton.

 

id   user  starttime             endtime             state

1    dave   6:28:06 pm       6:28:17  pm        pending

1    dave   6:28:35 pm       6:28:43 pm         in progress

1    dave   6:28:21 pm       6:28:35 pm         in progress

1    dave   6:28:17 pm       6:28:21 pm         in progress

2    roy     1:00:03 PM        1:00:06 pm         pending

2    roy      2:30:08 pm       2:30:12 pm        in progress

2    roy      1:00:14 Pm       1:00:29 pm        in progress

2    roy      1:00:06  pm      1:00:14  pm       in progree

 

I want to display time difference from pending to in progress where it should pick minimum time for pending state and it should subtract minimum time for in progress state.

vicky_
Super User
Super User

I'm thinking something like the following:
Measure = 
var pendingStartTime = CALCULATE(MIN([start_time]), ALLEXCEPT(Table, [taskid]), [status] = "pending")
var progressStartTime = CALCULATE(MIN([start_time]), ALLEXCEPT(Table, [taskid]), [status] = "progress")
return progressStartTime - progressEndTime 

what is the difference between your first soution and this one?

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.