Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Average on average - cannot summarize field Post Reply Post New Topic
Author Message
AndersV
Newbie
Newbie


Joined: 26 Nov 2007
Location: Sweden
Online Status: Offline
Posts: 1
Quote AndersV Replybullet Topic: Average on average - cannot summarize field
    Posted: 26 Nov 2007 at 1:16am
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
 
 


Edited by AndersV - 26 Nov 2007 at 1:27am
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 26 Nov 2007 at 9:49am
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.

(If this looks familiar, it's just you.)
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.031 seconds.