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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
GunnerJ
Post Patron
Post Patron

Find the difference in time after sorting by Service Order # and Time

I'm needing to find out how long certian tasks are taking. I have the columns BI_EVENT_DT_TM, BI_SO_NBR, and BI_TASK_CD. There's also BI_WRKFLW_TASK_SEQ_NBR but tasks are not always completed in the correct order so the sequence number can't be used. 

 

In order to get the needed results I need to have my dataset order by BI_SO_NBR so I'm just finding times for tasks within their respective service order, then order by BI_EVENT_DT_TM ascending. After they're ordered in the formula I then need to subtract the time between one line's BI_EVENT_DT_TM by the BI_EVENT_DT_TM of the task that was completed after it.

 

So if the a service order had 2 tasks in it one timed at 12:00:00 and the next at 12:00:10 I would get a value of 10 seconds or 00:00:10 for "TASK TIME" for the first task.

 

This code is close but not there yet. It returns the running sum of time for each Service order and the results are off by one row.

 

Column = VAR temp =
TOPN (
1,
FILTER (
Query1,
Query1[BI_SO_NBR] = EARLIER (Query1[BI_SO_NBR])
&& Query1[BI_EVENT_DT_TM] < EARLIER (Query1[BI_EVENT_DT_TM] )
),
Query1[BI_SO_NBR], DESC, Query1[BI_EVENT_DT_TM],ASC
)
RETURN
DATEDIFF ( MINX ( temp, Query1[BI_EVENT_DT_TM] ), Query1[BI_EVENT_DT_TM], SECOND)

  

Date Set SampleDate Set SampleHopeful End ResultHopeful End Result

0 REPLIES 0

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors