Crystal doesn't allow aggregates on formulas because it would require another pass through the data, which Crystal does not do. The value is 'known' until the report is run, by which time it is too late, Crystal calculates the aggregates during the second pass through the data (I think).
I usually think of aggregates using the values that come straight from the database. So if the value is not exactly from the database, Crystal won't sum it, might sum it incorrectly (if you conditionally suppress the display of a field, but use SUM on the field, all the values are display irregardless of the conditional suppression).
So the answer is:
variables...I like shared, though global will work as well.
They come in groups of 3, each is formula
1) reset, usually in a group header:
shared numbervar aTotal :=0;
"" //suppresses the 0 from being display
2) increment, usually in details, but in this case if gf2
shared numberbvar aTotal;
aTotal := aTotal + {another formula};
OR
aTotal := aTotal + {table.field};
"" // same reason
3) display, usually in a group footer
shared numbervar aTotal
HTH
Edited by lockwelle - 09 Dec 2010 at 3:44am