Link to home
Start Free TrialLog in
Avatar of RichardH1976
RichardH1976

asked on

crystal reports - summarise a formula field

I have picked up a report off someone who has left the company.  He has built the report with subreports to calculate a total and then a formula field to summarise each total.   The formula field is in a group footer to give a total by country.

I cannot summarise a formula field so have tried to calculate with variables.   the formula field is territoryordered.

So far I have in the report header.
(
WhilePrintingRecords;
Global NumberVar GTotal;

in the group header where the formula field is;
WhilePrintingRecords;
Global NumberVar GTotal;
GTotal:=GTotal+{@TerritoryOrdered};
GTotal

This is giving me the wrong total.  I would like to display the total in the report footer but I cannot get the correct amount to display in the group header.

Sorry I bet this is simple...   Richard
Avatar of Ido Millet
Ido Millet
Flag of United States of America image

Place {@TerritoryOrdered} in the group header.  Does it show the value you expect?  If not, look inside that formula to figure out the problem.  
Note: if that main report formula is grabbing a value from a subreport placed in the same group header, you must move that formula to a section BELOW the subreport section. For example, place the formula in GF1 or GH1b if the subreport is in GH1a.  This is because, within a section, formulas are evaluated before subreports.
Avatar of Mike McCracken
Mike McCracken

What is the @TerritoryOrdered formula?

As written the value in the group header will be  "running" total for the report to that point.

Are you trying to get the total of the formula for the group?

mlmcc
Avatar of RichardH1976

ASKER

The @territoryordered is a variable that adds all variables totals up which are in sub reports,  these are all in group headers.  1a, 2a, 3a etc...  There are 10 different territories and I get sub totals for each one.   I need to grand total the territory ordered formula field.
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial