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

3 formula summary not working 1

Status
Not open for further replies.

AZdesertdog

IS-IT--Management
Dec 2, 2003
88
US
I have a 24 month financial report that lists monthly totals of payments, charges, etc. One of the columns is called "APP" (average patient payments)and I'm trying to get an sum of a pre-determined 6 month group of these APP totals but I'm getting a total this is way to large. My amounts (@APP) are in the 300-400 range so I should get a sum in the 1800-2400 range but I'm getting 85,000+. I'm using a 3 formula process for this and many of the other columns but it's not working here. The formulas I'm using are below

in group 1 header (suppressed)
@ResetAPP
whileprintingrecords;
numbervar highlightsAPP := 0;

in details (suppressed)
@HighlightsAPP
whileprintingrecords;
numbervar highlightsAPP;
if {@Monthnumber} in [1,2,3,4,5,6]
then highlightsAPP := highlightsAPP + {@APP}
else highlightsAPP := highlightsAPP;

in group footer 1 (row that is viewed for each month)
@DisplayAPP
whileprintingrecords;
numbervar highlightsAPP;
highlightsAPP;

The @APP formula is:
Sum ({@Payments}, {Header.InitialCreatePeriod})
/distinctCount ({Header.InvoiceNumber}, {Header.InitialCreatePeriod})

I suspect the problem is in this APP formula since that's the only real difference from my other 3 formula sums. Any help appeciated as always!
 
You're probably correct about the @APP formula causing the problem. Try moving the Hilights formula from the details band into the {Header.InitialCreatePeriod} group header. I'm assuming this is a sub group of group header 1.

Mike
 
I would also change this formula

in group 1 header (suppressed)
@ResetAPP
whileprintingrecords;
numbervar highlightsAPP := 0;


to

in group 1 header (suppressed)
@ResetAPP
whileprintingrecords;

if not inRepeatedGroupHeader then
numbervar highlightsAPP := 0
else
0;

this way if a group straddles 2 pages you won't get an accidental reset of your total.

the "else 0" was added because in some versions of crystal it seems that leaving it off causes some problems with evaluating the formula. Since you have the formula correctly suppressed it doesn't matter.


Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top