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

Maximum and Minimum

Status
Not open for further replies.

psamedy

Technical User
Apr 22, 2002
60
US
Hello All

I have a graph grouped by Name displaying the average score per Name for q1, q2, q3.

I need to display on the page the individuals higest avg score and lowest avg score? THanks for any help. Pat

Name q1 q2 q3
---- -- -- --
Bob 1 4 3
Bob 5 3 4
Jed 3 2 4
Tom 2 5 1
 
The following formula will give you the maximum:

whileprintingrecords;
numbervar max;

if Average ({table.scoreQ1}, {table.name}) >
Average ({table.scoreQ2}, {table.name}) then
max := Average ({table.scoreQ1}, {table.name}) else
max := Average ({table.scoreQ2}, {table.name});
if Average ({table.scoreQ3}, {table.name}) > max then
max := Average ({table.scoreQ3}, {table.name}) else
max := max;

For the minimum, try:

whileprintingrecords;
numbervar min;

if Average ({table.scoreQ1}, {table.name}) <
Average ({table.scoreQ2}, {table.name}) then
min := Average ({table.scoreQ1}, {table.name}) else
min := Average ({table.scoreQ2}, {table.name});
if Average ({table.scoreQ3}, {table.name}) < min then
min := Average ({table.scoreQ3}, {table.name}) else
min := min;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top