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

Group Totals are okay, but Grand Totals calculate extra figures.

Status
Not open for further replies.

stcholly

Technical User
May 17, 2006
25
US
CR10 - Trying to sum my Contracts by Year and then have a Grand Total in my Report Footer.

The following is the formula (hidden) in my details section to accumulate:
WhilePrintingRecords;
numbervar RCyrtot;
numbervar RCgrtot;
if not({@YTD Costs Recognized} = 0 and {@YTD Revenue Earned} = 0 and {@Over-Billing} = 0 and {@Under-Billing} = 0)
then
RCyrtot := RCyrtot + Sum ({@Revised Contract Amt}, {CURRENT_JCT_TRANSACTION.Job});
RCgrtot := RCgrtot + Sum ({@Revised Contract Amt}, {CURRENT_JCT_TRANSACTION.Job});

This formula is hidden in the group1 header to reset for the Yr totals:
WhilePrintingRecords;
numbervar RCyrtot :=0;

This is the formula for my Year Total (in GFooter1):
WhilePrintingRecords;
numbervar RCyrtot;

This is the formula I have for my Grand Total in the report Footer:
WhilePrintingRecords;
numbervar RCgrtot;

My problem...The YR total is correct. It only includes the amounts for the Jobs that appear on my report. But, the Grand Total includes hidden jobs that do not meet the requirements in the first accumulating formula, and I cannot figure out why.

My 3 Yr totals equal $8.6, $16.9 and $9.2. They should sum to $34.7, but instead my GR total is showing $37.0

Any help is appreciated!
 
Consider showing example data and expected output rather than non-functioning formaulas, you'll be better off asking for architectural help then specifying it.

Adn don't reference formulas within other formulas without showing what they contain, unless you prefer drawn out posts.

If you want contract amounts by the year, insert a group on the contracts adn then the date field and select for each year.

Since you didn't share what's in any of the filtering formulas, I would suggest that you create Running Totals for the values and place your criteria in the Evaluate->Use a Formula, and make sure that you have at the group level and a grand total.

There are plenty of other approaches, I'm just trying to keep it simple here.

-k
 
Try changing your formula to:

WhilePrintingRecords;
numbervar RCyrtot;
numbervar RCgrtot;
if not({@YTD Costs Recognized} = 0 and {@YTD Revenue Earned} = 0 and {@Over-Billing} = 0 and {@Under-Billing} = 0)
then
(
RCyrtot := RCyrtot + Sum ({@Revised Contract Amt}, {CURRENT_JCT_TRANSACTION.Job});
RCgrtot := RCgrtot + Sum ({@Revised Contract Amt}, {CURRENT_JCT_TRANSACTION.Job})
);

-LB
 
The IF/THEN clause is only working on RCyrtot := RCyrtot + Sum ({@Revised Contract Amt}, {CURRENT_JCT_TRANSACTION.Job});
Try this...

Numbervar Amount;
Numbervar RCyrtot;
Numbervar RCgrtot;

if not({@YTD Costs Recognized} = 0 and {@YTD Revenue Earned} = 0 and {@Over-Billing} = 0 and {@Under-Billing} = 0)
then
Amount := Sum ({@Revised Contract Amt}, {CURRENT_JCT_TRANSACTION.Job});
RCyrtot := RCyrtot + Amount;
RCgrtot := RCgrtot + Amount;
 
LB-
Tried your suggestion first, and it worked. I would have never thought the () would have made the difference. Again, you have bailed me out! Much appreciated!

Teknogeek9 & synapsevampire -
Thanks to both of you for the responses!

HS [ponytails]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top