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!

How to Summarize a column of Max fields 1

Status
Not open for further replies.

pk400i

MIS
Feb 10, 2009
102
US
I have this column of fields that are inserted to the report as Summary max fields, yet this column needs to be summarized but I am having difficulties to make this summarization. AS one cannot summarize on such a field.
 
You can't summarise a summary, that' basic to Crystal. But if you're going a summary on a group and want it for the whole report, you can make a new summary total using the same rules for the whole report.

If you're not already familiar with Crystal's automated totals, see FAQ767-6524.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
I don't see the choice for Running totals. Could I use the WHilePrintingrecords?
 
I see the Running total. But it's not correct.
 
You should be more specific about what you are trying to do. If you are trying to sum group maximums, then you could use a variable, like this:

//{@summax} to be placed in the group section containing the maximum summary:
whileprintingrecords;
numbervar summax := summax + maximum({table.amt},{table.groupfield});

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

If you want the new summary in a higher order group #1 (for example), then you would need a reset formula in the GH#1:

whileprintingrecords;
numbervar summax;
if not inrepeatedgroupheader then
summax := 0;

...and the display formula would go in the GF#1.

-LB
 
The way its' done is to use the whiltprintrecords and then print the bucket at the end.
 
There is a change. It has to sum across the line.
One field is a Group Sum (4 of them) and the other is a group Max (also 4 of them).
The result of this formula is a little higher than it should be:

WhileprintingRecords;
Numbervar q1;
q1:=q1+ (sum ({@Quoted 1}, {Command.CUSTNAME})) + Sum ({@Quoted 2}, {Command.CUSTNAME}) +Sum ({@Quoted 3}, {Command.CUSTNAME}) + Sum ({@Quoted 4}, {Command.CUSTNAME}) + Maximum ({@Billed 1}, {Command.CUSTNAME}) + Maximum ({@Billed 2}, {Command.CUSTNAME}) + Maximum ({@Billed 3}, {Command.CUSTNAME}) + Maximum ({@Billed 4}, {Command.CUSTNAME});
q1;




 
You need to display the results in a separate formula that does not also accumulate, as in, which should be placed in the appropriate footer section (you still haven't said whether you are looking for a report total or a higher order group total):

WhileprintingRecords;
Numbervar q1;

-LB
 
Lbass, It's a line across total, where one set of fields is a group Sumed field, and the other is a group Maxed field.
 
I understand that. Did you try what I suggested?

Or are you saying that you ONLY need to sum them at their own group level? If so, you don't need a variable, just a formula like this:

sum ({@Quoted 1}, {Command.CUSTNAME})) +
Sum ({@Quoted 2}, {Command.CUSTNAME}) +
Sum ({@Quoted 3}, {Command.CUSTNAME}) +
Sum ({@Quoted 4}, {Command.CUSTNAME}) +
Maximum ({@Billed 1}, {Command.CUSTNAME}) +
Maximum ({@Billed 2}, {Command.CUSTNAME}) +
Maximum ({@Billed 3}, {Command.CUSTNAME}) +
Maximum ({@Billed 4}, {Command.CUSTNAME})

-LB
 
Yes that one is not the right amount its' too high by about $300.
 
i've got one case where the entire line is 0 except the last figure and the total is $300 more.
 
The Whileprintingrecords works but it works for one field I need to add the 7 other whileprintingrecords into one total for a line total.
 
Sorry for so many posts. Here I've got it.
You can do more than one Whileprintingrecords

WhileprintingRecords;
Numbervar q1;
q1:=q1+ (sum ({@Quoted 1}, {Command.CUSTNAME}));
q1;

WhileprintingRecords;
Numbervar q2;
q2:=q2+ (sum ({@Quoted 2}, {Command.CUSTNAME})) + q1;
q2;

Interestingly the extra $300 on your formula was the adding of the second to the first.
 
Sorry all, Lbass had the correct formula as well my mistake, but my formula will also work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top