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

Gap between two values 1

Status
Not open for further replies.

jesperengel

Technical User
Nov 7, 2005
18
0
0
DK
Using CRvXI

I have a report that contains a field "Club" and a field Average Carry (average of a database field named Carry). For every Club it lists the average carry for each Club. So far so good.

Now I would like a way to list the difference or gap between two Clubs. Is there any way I can du that??

Club Avg. Carry Gap
9i 110
14
8i 124
15
7i 139
15
6i 144

And so forth.

Thank you!
 
Hi Jesperengel,

Juste create a Formula with

{Avg. Carry} - previous({Avg. Carry})

And you'll have the diff between your two club

Jean-Paul Leboeuf

jleboeuf@iquebec.com
 
First insert another group header section and place the groupname in GH#1b. Also, insert an average on {table.carry} and drag that into GH#1b. Then create these formulas:

//{@Reset} to be placed in GH#1a (then suppress this section):
whileprintingrecords;
numbervar carry := 0;
numbervar cnt := 0;

//{@accum} to be placed in the detail section (suppress the detail section):
whileprintingrecords;
numbervar carry := carry + {table.carry};
numbervar cnt := cnt + 1;

//{@ave} to be placed in GF#1 (then suppress GF#1):
whileprintingrecords;
numbervar carry;
numbervar cnt;
numbervar ave;
if cnt > 0 then
ave := carry/cnt;

//{@diff} to be placed in GH#1b:
whileprintingrecords;
numbervar ave;
if groupnumber <> 1 then
ave - average({table.carry},{table.club});

Every report section except GH#1b should be suppressed.

-LB
 
Hello again,

jleboef, thank you for your suggestion, but I ended up using the suggestion from lbass, which suited my report better.

Lbass, you are my star. A pure genius!

Thank you!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top