manoharvankired
2 years agoQrew Trainee
How to calculate the number of hours between four date/time fields, excluding weekends
let (
start = ToDate([Start Date]),
end = ToDate([End Date]),
onHoldStart = ToDate([On Hold Start Date]),
onHoldEnd = ToDate([On Hold Stop Date]),
duration = If(
Not(IsNull(start)) and Not(IsNull(end)) and Not(IsNull(onHoldStart)) and Not(IsNull(onHoldEnd)),
WeekdaySub(end, start) - WeekdaySub(onHoldEnd, onHoldStart),
0
),
durationInDays = ToDays(duration),
durationInHours = ToInt(Duration(0, 0, durationInDays).ToHours()),
durationInMinutes = ToInt(Duration(0, 0, durationInDays).ToMinutes())
);
durationInHours & " hours " & durationInMinutes & " minutes"
I'm getting error please see attached screenshot
Note: output field type is duration
------------------------------
manohar vankireddy
------------------------------