Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Daily Average 1

Status
Not open for further replies.

mdelgado100

Technical User
Jul 14, 2004
13
US
DAILY AVERAGE IN A MONTHLY REPORT - I am not sure how to even go about doing this, so if you have any ideas. I am using Crystal 8.5. with An Access data base I created.

I have a date_field which is grouped by month in my report.
I have a item_type which is counted and inputted daily.

I am able to get the montly totals they are good. But when I have attempted to get the average of the items per day by doing: {Item_type}/{date_field}, the output is incorrect.

I've tried doing itemtype/month(currentdate), that doesn't work. Any Ideas. I'd be a happy to provide further info.
 
If what you want is the average of the daily count of {table.itemtype}, then first insert a second group on {table.date}, this time setting it to print on change of day. Then create three formulas:

//{@reset} to be placed in Group #1 (date-monthly) Header:
whileprintingrecords;
numbervar sumcnt := 0;
numbervar counter := 0;

//{@accum} to be placed in the Group #2 (date-daily) Header:
whileprintingrecords;
numbervar counter := counter + 1;
numbervar sumcnt := sumcnt + count({table.itemtype},{table.date});

//{@displave} to be placed in the Group #1 (date-monthly) Footer:
whileprintingrecords;
numbervar sumcnt;
numbervar counter;
sumcnt/counter

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top