-
1
- #1
Hello All,
I have the following formula to calculate the time duration (in business hours) it takes to resolve help desk tickets. The formula below works well….
…with the exception of a few oddities that display negative durations. An example is below.
What’s wrong with this formula!?!?!?!
Thanks for any/all assistance!!!
- Tom
I have the following formula to calculate the time duration (in business hours) it takes to resolve help desk tickets. The formula below works well….
Code:
Local DateTimeVar StartDate := DateTime({PROBLEMS.OPEN_DATE},{PROBLEMS.OPEN_TIME}) - (5/24);
Local DateTimeVar EndDate := DateTime({PROBLEMS.SOLVED_DATE},{PROBLEMS.SOLVED_TIME}) - (5/24);
Local NumberVar TotDuration;
Local NumberVar TotWeekends;
Local NumberVar TotNonBusinessHrs;
TotNonBusinessHrs := DateDiff ("d", StartDate, EndDate) -
DateDiff ("ww", StartDate, EndDate, crSaturday) -
DateDiff ("ww", StartDate, EndDate, crSunday);
TotNonBusinessHrs := TotNonBusinessHrs * 14;
TotDuration := DateDiff ("n", StartDate, EndDate);
TotWeekends := (DateDiff ("ww", StartDate, EndDate, crSaturday) +
DateDiff ("ww", StartDate, EndDate, crSunday) );
TotWeekends := TotWeekends * 24;
TotDuration := TotDuration / 60;
TotDuration := (TotDuration - TotWeekends) - TotNonBusinessHrs;
TotDuration
…with the exception of a few oddities that display negative durations. An example is below.
Code:
Open_Date Solved_Date Duration
4/6/2005 7:43:00 PM 4/7/2005 7:36:18 AM -2.12
4/26/2005 7:56:40 PM 4/27/2005 8:38:51 AM -1.30
4/5/2005 6:35:06 PM 4/6/2005 7:53:38 AM -0.70
4/19/2005 5:24:18 PM 4/20/2005 6:49:47 AM -0.58
4/14/2005 6:20:11 PM 4/15/2005 7:50:53 AM -0.50
Thanks for any/all assistance!!!
- Tom