Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi!
I have investigated heavely in the forum, but have not been able to solve my issue.
I am using the following data set and need to calculate the time between two operations.
From when the previous ended till the next one start. The different orders can have a different variety of steps, but the Jobid can always be sorted to know the correct order:
I have tried to highlight the date times i want to calculate the difference between, on the first line for each modulerefid i expect to be 0.
Solved! Go to Solution.
You could do this in a calculated column, but there are is a caveat. If you know that the previous job will always finish before the current one starts then
Time between jobs =
var currentStartTime = 'Table'[Start Time]
var currentModule = 'Table'[ModuleRefID]
var prevEndTime = CALCULATE( MAX( 'Table'[End Time]), 'Table'[ModuleRefID] = currentModule,
'Table'[End Time] < currentStartTime )
return DATEDIFF( prevEndTime, currentStartTime, MINUTE )
You can change the granularity of the DATEDIFF to whatever you need.
Try changing the prev end time line to
var prevEndTime = CALCULATE( MAX( 'Table'[End Time]), REMOVEFILTERS('Table'),
'Table'[ModuleRefID] = currentModule,
'Table'[End Time] < currentStartTime )
You could do this in a calculated column, but there are is a caveat. If you know that the previous job will always finish before the current one starts then
Time between jobs =
var currentStartTime = 'Table'[Start Time]
var currentModule = 'Table'[ModuleRefID]
var prevEndTime = CALCULATE( MAX( 'Table'[End Time]), 'Table'[ModuleRefID] = currentModule,
'Table'[End Time] < currentStartTime )
return DATEDIFF( prevEndTime, currentStartTime, MINUTE )
You can change the granularity of the DATEDIFF to whatever you need.
Hi
I have just tested your solution but i do not get any values.
Try changing the prev end time line to
var prevEndTime = CALCULATE( MAX( 'Table'[End Time]), REMOVEFILTERS('Table'),
'Table'[ModuleRefID] = currentModule,
'Table'[End Time] < currentStartTime )
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 169 | |
| 109 | |
| 91 | |
| 55 | |
| 44 |