jehanzebn
Programmer
- May 28, 2001
- 244
Dear all,
I have created a report which is grouped by Reorder code, the report counts number of jobs(Running Total),number of lenses(Running Total) and average per day of jobs and lenses (Formula).
Formula for average per day
What I would like to add in the same report is Month to date, Year to Date and Last 4 weeks averages. I tried the following code, which works fine if I create a separate report with single Month to date formula but this doesn't work within the current report. Meaning for some reason I cannot use the MTD formula under same report. Similarly with YTD and L4W.
Code for MTD Average
Please note: The date is already set up to current date i.e. I am using two current date formulas.
Report Record Selection formula
Any help would be grateful appreciated.
many thanks
Regards
Jehanzeb
I have created a report which is grouped by Reorder code, the report counts number of jobs(Running Total),number of lenses(Running Total) and average per day of jobs and lenses (Formula).
Formula for average per day
Code:
Whileprintingrecords;
Numbervar JAvg;
Numbervar myaverage=0;
Numbervar CAvg=0;
myaverage := {#Total Jobs};
CAvg:= myaverage /({@EndDate}-{@StartDate}+1);
JAvg:=JAvg + CAvg;
CAvg
What I would like to add in the same report is Month to date, Year to Date and Last 4 weeks averages. I tried the following code, which works fine if I create a separate report with single Month to date formula but this doesn't work within the current report. Meaning for some reason I cannot use the MTD formula under same report. Similarly with YTD and L4W.
Code for MTD Average
Code:
Whileprintingrecords;
Numbervar FAvg;
Numbervar myaverage=0;
Numbervar CAvg=0;
myaverage := {#Total Lenses};
CAvg:= myaverage /Day(Maximum(MonthToDate));
FAvg:=FAvg + CAvg;
CAvg
Please note: The date is already set up to current date i.e. I am using two current date formulas.
Report Record Selection formula
Code:
{lab_rework.rework_date} in {@StartDate} to {@EndDate} and
{lab_reasons.reason_code} >= {?startcode} and
{lab_reasons.reason_code} <= {?endcode}
Any help would be grateful appreciated.
many thanks
Regards
Jehanzeb