I am trying to calculate the average # of days per examiner based on policy numbers but am having problems. For each policy, I calculate the # of business days it takes from time received to the first time action was taken. My formula is as follows:
{@days_intial}
WhilePrintingRecords;
DateVar Start := date({uvw_Recd_STD_LTD.newEnterDate});
DateVar End := date({@Change_date});
NumberVar Weeks;
NumberVar Days;
NumberVar Hol:= 0;
//Figure the number of Calendar "Rows" involved and count 5 days for each:
Weeks:= (Truncate (End - dayofWeek(End) + 1 - (Start - dayofWeek(Start) + 1)) /7 ) * 5;
//Adjust the first and last weeks based on when in the week you start and end
Days := DayOfWeek(End) - DayOfWeek(Start) + 1
+ (if DayOfWeek(Start) = 1 then -1 else 0) //adjust for starting on a Sunday:
+ (if DayOfWeek(End) = 7 then -1 else 0); //adjust for ending on a Saturday:
//Adjust for Holidays in the period between the start and end dates:
//2004:
if Date(2004,01,01) in start to end then Hol:= Hol+1 else Hol:= Hol;
if Date(2004,01,19) in start to end then Hol:= Hol+1 else Hol:= Hol;
if Date(2004,05,24) in start to end then Hol:= Hol+1 else Hol:= Hol;
if Date(2004,07,05) in start to end then Hol:= Hol+1 else Hol:= Hol;
if Date(2004,09,06) in start to end then Hol:= Hol+1 else Hol:= Hol;
if Date(2004,11,25) in start to end then Hol:= Hol+1 else Hol:= Hol;
if Date(2004,11,26) in start to end then Hol:= Hol+1 else Hol:= Hol;
if Date(2004,12,23) in start to end then Hol:= Hol+1 else Hol:= Hol;
if Date(2004,12,24) in start to end then Hol:= Hol+1 else Hol:= Hol;
//Assemble the adjusted work days
Weeks + Days - Hol
In order to get the first time action was taken, the below formula is used:
{@Change_date}
if next({uvw_svctime_hist.STATUS}) = 'initial'
then {uvw_svctime_hist.CHANGE_DATE}
else
next ({uvw_svctime_hist.CHANGE_DATE})
The formula I'm trying to use to calculate average based on examiner is:
{@Average}
average({@days_intial}, {uvw_Recd_STD_LTD.examiner})
But because I have the {@Change_date} included in the {@days_intial} it doesn't work.
Any suggestions would be greatly appreciated!
~Kim
{@days_intial}
WhilePrintingRecords;
DateVar Start := date({uvw_Recd_STD_LTD.newEnterDate});
DateVar End := date({@Change_date});
NumberVar Weeks;
NumberVar Days;
NumberVar Hol:= 0;
//Figure the number of Calendar "Rows" involved and count 5 days for each:
Weeks:= (Truncate (End - dayofWeek(End) + 1 - (Start - dayofWeek(Start) + 1)) /7 ) * 5;
//Adjust the first and last weeks based on when in the week you start and end
Days := DayOfWeek(End) - DayOfWeek(Start) + 1
+ (if DayOfWeek(Start) = 1 then -1 else 0) //adjust for starting on a Sunday:
+ (if DayOfWeek(End) = 7 then -1 else 0); //adjust for ending on a Saturday:
//Adjust for Holidays in the period between the start and end dates:
//2004:
if Date(2004,01,01) in start to end then Hol:= Hol+1 else Hol:= Hol;
if Date(2004,01,19) in start to end then Hol:= Hol+1 else Hol:= Hol;
if Date(2004,05,24) in start to end then Hol:= Hol+1 else Hol:= Hol;
if Date(2004,07,05) in start to end then Hol:= Hol+1 else Hol:= Hol;
if Date(2004,09,06) in start to end then Hol:= Hol+1 else Hol:= Hol;
if Date(2004,11,25) in start to end then Hol:= Hol+1 else Hol:= Hol;
if Date(2004,11,26) in start to end then Hol:= Hol+1 else Hol:= Hol;
if Date(2004,12,23) in start to end then Hol:= Hol+1 else Hol:= Hol;
if Date(2004,12,24) in start to end then Hol:= Hol+1 else Hol:= Hol;
//Assemble the adjusted work days
Weeks + Days - Hol
In order to get the first time action was taken, the below formula is used:
{@Change_date}
if next({uvw_svctime_hist.STATUS}) = 'initial'
then {uvw_svctime_hist.CHANGE_DATE}
else
next ({uvw_svctime_hist.CHANGE_DATE})
The formula I'm trying to use to calculate average based on examiner is:
{@Average}
average({@days_intial}, {uvw_Recd_STD_LTD.examiner})
But because I have the {@Change_date} included in the {@days_intial} it doesn't work.
Any suggestions would be greatly appreciated!
~Kim