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

Average of a count

Status
Not open for further replies.

JRine0101

Programmer
Feb 4, 2005
5
US
I'm trying to display an average (in my group 2 footer) of a formula, but get a message that says "this field cannot be summarized".

This is the formula I tried. It should reside in group footer 1 (product family):
Average ({@Penetration},{QryCustomerAvg.Family Description})

The @penetration is the field that cannot be summarized.

@penetration is calculated in group footer 2 (customer). The formula is:
if {@AvailableProducts}=0 then 0 else
({@DistinctCountValue}/{@AvailableProducts})*100

In non-tech terms, penetration is the percentage of our products within a product family that a customer has purchased. For example, we have a product family of stickers and offer 20 different kinds. If a customer purchased 10 of those, penetration is 50%.

I want the average of this penetration level for each product family.

I'm new to Crystal Reports so I may be missing the obvious.



 
Since @penetration is already based on formulas, which you didn't bother to share the contents of, they are likely the culprits as you can't use a summary function against a summary function.

Try rolling your own average by storing the values in variables within a formula:

In the gh1 place the following:

numbervar DCV:=0;
numbervar AP:=0;

In the gh2 or gf2 place the following:
numbervar DCV;
numbervar AP;
if {@AvailableProducts}=0 then
0
else
dcv:=dcv+{@DistinctCountValue}
ap:=ap+{@AvailableProducts}

In Gf1 use:

numbervar DCV;
numbervar AP;
(dcv/ap)*100

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top