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!

sum a max v.8.5

Status
Not open for further replies.

tomk01

ISP
Oct 18, 2004
69
US
Hello All,

Is there a way to sum the max of a number

example

database
15.5
13.5
12.2

report
15.5
13.5
(both max)

what I need
15.5
13.5
--------
29.0
 
create a summary formula for the field in the database
Sum ( db.fieldname )
Wacki
 
when I do that I get the "cant calc running total
 
Try placing an evaluation time at the top of your function someting like 'WhileReadingRecords' should help.

Wacki
 
You haven't shown your group field. You could either create two formulas like the following:

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

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

Or you could create a SQL expression like the following {%maxamt}:

(select max(AKA.`amt`) from Table AKA where
AKA.`groupfield` = Table.`groupfield`)

You would substitute your table name wherever you see "Table", your exact field names for "amt" and "groupfield".

Then in the record selection formula use:

{table.amt} = {%maxamt}

Then you could just insert a summary on {%maxamt}.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top