Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.
Hello,
I have this table, the column completion time usually shows a time the next day (see data table, so if 18.02 the completion time at 03:20 means its 3:20AM 19.02), the start is always at 18 in the evening same day as column date.
When I use this formula, I see wrong result...for example when the start time is 6PM and end time is 13:14 the next day, the duration is 17h14m instead I see 7.23 h...
formula I used is:
Solved! Go to Solution.
Hi, @Anonymous
Actually, I think the duration is 19,23 hours in your case.
Here's the solution:
TimeDiff =
var currentDay = 'Table'[Date] + 'Table'[Start]
var NextDay__ = ('Table'[Date]+1) + 'Table'[End]
var datedifCalc = DATEDIFF(currentDay, NextDay__, MINUTE) / 60
return datedifCalc
Hello,
I fugured how to calculate for exceptional days when the load was in the same day, first I create a load same date column:
Dear vojtech,
It looks great to me. I just have 1 question on how to handle an exception when the completion time is not in the next day but in the current day, here below th calculation is wrong:
Hi, @Anonymous ,
that's kinda complicated, with data structure like you have, you have to manually evaluate like, if the end of job is between 18-23:59, calculte result for today, othewrise for next day, but that's hard coded andnot that flexible, but it will work if you know that the job won't take longer than 24 hours.
@Anonymous - I attempted as:
Diff Time of Load =
VAR __initialDateTime =
DATEVALUE ( TableName[Date] ) + TIMEVALUE ( TableName[Initial Time] )
VAR __completionDateTime =
( DATEVALUE ( __initialDateTime ) + 1 )
+ TIMEVALUE ( TableName[Completion Time] )
VAR Result = __completionDateTime - __initialDateTime
RETURN
Result
with a format change as: 13:30 (hh:nn)
Proud to be a Super User!
Hi, @Anonymous
Actually, I think the duration is 19,23 hours in your case.
Here's the solution:
TimeDiff =
var currentDay = 'Table'[Date] + 'Table'[Start]
var NextDay__ = ('Table'[Date]+1) + 'Table'[End]
var datedifCalc = DATEDIFF(currentDay, NextDay__, MINUTE) / 60
return datedifCalc
Check out the November 2023 Power BI update to learn about new features.
Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.