Click to See Complete Forum and Search --> : Average on average - cannot summarize field


AndersV
November 26th, 2007, 04:32 AM
Hello!

Im having trouble summarizing a formula field. Using version 10

AVERAGE(field1, field2) Im doing an average based on another field. It works fine but in the footer i want to do an AVERAGE again based on the formula field an on the count of the rows.

Like this:

0.2
0.3
0.4

---
AVERAGE(formulafield, count rows)

But ive realised that you cannot do this in crystal. So is there any other solution to do this problem?

Regards A

Lugh
November 26th, 2007, 12:18 PM
There are two basic solutions to this problem.

One is to create a manual running total of the formula. Declare a global variable. With each record, add the current average to this variable. In the footer, simply divide the variable (now the sum of all your averages) by a count of the records (using the Count function). This will give you an average of the averages.

A second is to re-create the essence of the earlier averages in a formula. In this case, that could be tricky (as taking the sum of a bunch of sums is certainly a lot cleaner than taking the average of a bunch of averages). In fact, after poking it for about ten minutes here, I'm not sure I could do it. But, the general thrust is to step back and try to generate the same number using the base records, rather than trying to make Crystal work through your average. If you have a known and relatively small number of groups that you are taking averages over, I could do it. But, I can't come up with a generalized solution off the top of my head.

AndersV
December 3rd, 2007, 09:10 AM
First solution is what we´ve tried. But didn´t get it to work :(

Could you show me an example of how you would do it ?