I am not able to have my record count reset at the correct level. If I move the count, it divides by zero. At the moment it calculates ok at the group 1 level but I need it to reset at group 2 (months).
My report summarises the duration of legal services provided to clients. It is sorted into months and then client to show an average duration for each client and then for all clients for each month. I then deduct the 20% worst durations to give a net average duration). You provided the solution in an earlier thread (thread767-1338989) but you do not need to refer to it for this question. I am using CR9 and an access database.
The records are laid out like this:
completed cases ave days
Month1 32 22.47 (Group1)
Client1 549 30.49 (Group2)
Case1 SLAdays (Detail) - formula below
Case2 etc.
Group 1 header (counts the completion date field)
Group 2 footer (counts the completion date field and averages SLAdays)
Formulas:
@Accum (
whileprintingrecords;
numbervar cnt := cnt + 1;
numbervar cntx;
numbervar sumdiff;
if cnt > round(.2* Count ({FTRK_Reports.CompletionDate}, {FTRK_Reports.CompletionDate}, "monthly"))
then (cntx := cntx + 1;
sumdiff := sumdiff + {@SLAdays});
@Ave
whileprintingrecords;
numbervar cntx;
numbervar sumdiff;
sumdiff/cntx;
@Reset
whileprintingrecords;
numbervar cnt := 0;
numbervar cntx := 0;
numbervar sumdiff := 0;
@SLAdays
WhilereadingRecords;
//Set the values of Start Date and End Date
DateVar StartDate := Date({FTRK_Reports.MrtgOfferRcvd});
DateVar EndDate := Date({FTRK_Reports.CompletionDate});
//Find out the difference in days and subtract the weekends
NumberVar DaysDiff := (DateDiff("d",StartDate,EndDate)) -
DateDiff("ww",StartDate,EndDate,crsaturday) -
DateDiff("ww",StartDate,EndDate,crsunday);
My report summarises the duration of legal services provided to clients. It is sorted into months and then client to show an average duration for each client and then for all clients for each month. I then deduct the 20% worst durations to give a net average duration). You provided the solution in an earlier thread (thread767-1338989) but you do not need to refer to it for this question. I am using CR9 and an access database.
The records are laid out like this:
completed cases ave days
Month1 32 22.47 (Group1)
Client1 549 30.49 (Group2)
Case1 SLAdays (Detail) - formula below
Case2 etc.
Group 1 header (counts the completion date field)
Group 2 footer (counts the completion date field and averages SLAdays)
Formulas:
@Accum (
whileprintingrecords;
numbervar cnt := cnt + 1;
numbervar cntx;
numbervar sumdiff;
if cnt > round(.2* Count ({FTRK_Reports.CompletionDate}, {FTRK_Reports.CompletionDate}, "monthly"))
then (cntx := cntx + 1;
sumdiff := sumdiff + {@SLAdays});
@Ave
whileprintingrecords;
numbervar cntx;
numbervar sumdiff;
sumdiff/cntx;
@Reset
whileprintingrecords;
numbervar cnt := 0;
numbervar cntx := 0;
numbervar sumdiff := 0;
@SLAdays
WhilereadingRecords;
//Set the values of Start Date and End Date
DateVar StartDate := Date({FTRK_Reports.MrtgOfferRcvd});
DateVar EndDate := Date({FTRK_Reports.CompletionDate});
//Find out the difference in days and subtract the weekends
NumberVar DaysDiff := (DateDiff("d",StartDate,EndDate)) -
DateDiff("ww",StartDate,EndDate,crsaturday) -
DateDiff("ww",StartDate,EndDate,crsunday);