Greg_Deckler
8 years agoCommunity Champion
Net Work Duration (Working Hours)
Similar to Net Work Days, Net Work Duration calculates the total duration between two date/time columns taking into account non-working days (weekends) as well as the start and end times for a work d...
spriyanshu
3 years agoFrequent Visitor
Hi Greg_Deckler
I am trying to use your code for same kind of calculation but no need to account for holidays. Will bottom modification willl work.
My Use case: i just want to calculate time (in minutues) used in maintenance window between 1 am to 6 am.
measure =
I am trying to use your code for same kind of calculation but no need to account for holidays. Will bottom modification willl work.
My Use case: i just want to calculate time (in minutues) used in maintenance window between 1 am to 6 am.
measure =
VAR __dateStart = MAX([INCIDENT STARTED])
VAR __dateEnd = MAX([SERVICE_RESTORED])
VAR __startTime = TIME(1,0,0)
VAR __endTime = TIME(6,0,0)
VAR __fullDayMinutes = DATEDIFF(__startTime,__endTime,MINUTE)
VAR __startDayTime = TIME(HOUR(__dateStart),MINUTE(__dateStart),SECOND(__dateStart))
VAR __startDayDuration = DATEDIFF(__startDayTime,__endTime,MINUTE)
VAR __endDayTime = TIME(HOUR(__dateEnd),MINUTE(__dateEnd),SECOND(__dateEnd))
VAR __endDayDuration = DATEDIFF(__startTime,__endDayTime,MINUTE)
RETURN
IF(DATEDIFF(__dateStart,__dateEnd,MINUTE), __startDayDuration + __endDayDuration)