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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formulas to get Averages for COUNT totals 1

Status
Not open for further replies.

lcutliffe

IS-IT--Management
Dec 1, 2006
30
0
0
US
Hi,
I'm trying to get averages for columns that are reached by getting counts and sums of the fields but i'm not sure of how to go about it.

For Example:

Line Count
398 <--(Count of Coitem_line):
45
58

Average: (I need the average of the above)
 
You can't summarise a summary in Crystal. You can get the same effect by creating another total that starts for the details and sums it overall.

The use of Crystal's automated totals is outlined at FAQ767-6524.


[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 10 & 11.5 with Windows XP [yinyang]
 
You can use variables for this. Please identify your group fields and what section the summaries are in (in your sample) and also explain at what level you want the average.

-LB
 
Ok,

My group field is custaddr.name

My sample shows a column of counted lines for each customer. I copied the COUNT total from the Group Footer and pasted it in GH1b for display purposes along with the customer name.

I am trying to get that column of numbers averaged and placed in the report footer as an AVG total line count for all the customers.

I have the same exact situation in other columns on the same report that need to avg out SUMS and specific FORMULAS to get the final overall averages and put them in the same place on the report. I'm hoping its kinda like a standard set of formulas that you just plug different values to accomodate these different types of totals.

I hope I explained it clearly enough, because this is way b eyond my expertise in crystal reports! Thanks!
 
Create a formula like this, place it in the group header or footer and suppress it:

whileprintingrecords;
numbervar sumcnt := sumcnt + count({table.CoItem_Line}, custaddr.name});
numbervar cnt := cnt + 1;

Then in the report footer add this formula:
whileprintingrecords;
numbervar sumcnt;
numbervar cnt;
if cnt <> 0 then
sumcnt/cnt

You can use the same syntax for other other fields, just adding another variable like "sumcnt", but with a different name and which sums a different field. The cnt variable can be used in all formulas.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top