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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.