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!

Subtotal on formula field

Status
Not open for further replies.

tcimis

MIS
Jun 6, 2002
32
We have a report that joins a header record with child records. The header record contains a budget field which covers all children (budget total is 150). When we subtotal it obviously gives us the budget field * the number of children (300 instead of the 150 if we have 2 children). We have created a formual field to count the children and divide the budget total by the number of children. We now want to subtotal that field to get a total budget amount for all the records in the report. Doesn't allow us to right click on the field and create a subtotal.

What we want to end up with is a subtotal for each header that has the budget total for the header along with information on the children and then a grand total of the budget total for all header records.

Is there an easy way to do this? We are using Crystal 8.5.
Thanks!
 
Instead of using a formula to divide budget amount by the number of children, you could just insert a maximum on {table.budget} at the group level, since there is only one budget figure per group. To add the budget figures across groups, use a variable:

//{@accum} to be placed in the group header or footer:
whileprintingrecords;
numbervar sumbudg := sumbudg + maximum({table.budget},{table.groupfield});

//{@display} to be placed in the report footer:
whileprintingrecords;
numbervar sumbudg;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top