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

Using a Summary and a MAX value? 1

Status
Not open for further replies.

DBLoser

MIS
Apr 7, 2004
92
US
I'm using Crystal XI R2. Here's a sample of my data set (grouped as you would see it in a report):

Quote Line QtyNo Qty UnitPrice QtyTotal
1500
1
1 1 5000 5000
2 50 4500 225000

2
1 1 2000 2000
2 10 1500 15000

For each Quote I have multiple lines. For each Line there may be multiple price breaks (always at least one). QtyTotal is a calculated field.

I need to calculate a total for each Quote but I only want to use the MAX QtyTotal of each Line.

I can easily insert a summary:

MAX of @Total (Number)

This does select the largest QtyTotal per each Line. The problem is, when I try to insert a Summary, I can not select the "MAX of @Total (Number) field"; it does not appear in the list of selectable fields.

I thought about trying to use a running sum but it would have to reset for each Quote. I'm stuck.

Any help is much appreciated!
 
Do you want to sum the maximums? If so, first insert a group on quote and then one on line. Then create these formulas:

//{@reset} to be placed in the quote group header and suppressed:
whileprintingrecords;
numbervar summax;
if not inrepeatedgroupheader then
summax := 0;

//{@accum} to be placed in the line group header or footer and suppressed:
whileprintingrecords;
numbervar summax;
if {@total} = maximum({@total},{table.line}) then
summax := summax + maximum({@total},{table.line});

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

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top