Focal Point
Grand Totals and Averages in two separate rows

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8291081792

August 27, 2008, 12:55 PM
shravan
Grand Totals and Averages in two separate rows
Hello everybody,

I am trying to do Grand Totals AND Averages. I need my output to look like this.

Days Amount_Financed Outstanding_Principal
170 $4520 $0
693 $4520 $0
300 $1850 $1850
-------------------------------------------------------
Totals $10620 $1850
----------------------------------------------------------
Averages 388 $3540 $617.

I know how to do column totals. I know how to do averages. (I don't know how to do both in two separate rows. Big Grin). Can somebody please help me in this ?

Thanks.

Shravan


7.7.03, Windows 7, SQL Server 2005
August 27, 2008, 01:44 PM
BarbaraA
You can use an ON TABLE SUBFOOT to control the two different rows. Getting the totals is easy because you can just use TOT. in front of the fields. Unfortunately using AVE. doesn't work that way. Here is how I have gotten it to work:

DEFINE FILE CAR
CNT_REC/I9 WITH COUNTRY=1;
END

TABLE FILE CAR
SUM RETAIL_COST DEALER_COST
TOT.RETAIL_COST NOPRINT
TOT.DEALER_COST NOPRINT
TOT.CNT_REC NOPRINT

BY COUNTRY

ON TABLE RECAP AVE_RC/D11.2=TOT.RETAIL_COST/TOT.CNT_REC;
AVE_DC/D11.2=TOT.DEALER_COST/TOT.CNT_REC;

ON TABLE SUBFOOT
"TOTALS "AVERAGES
END

The DEFINE and TOT.CNT_REC get the total number of records into the internal matrix. The TOT.RETAIL_COST and TOT.DEALER_COST get the totals for each field into the internal matrix. Now the ON TABLE RECAP can use those values.

In my example, using just AVE.fieldname in the SUBFOOT doesn't give the correct value.

Hope this helps!


WF Reporting Server 71x, 76x
August 27, 2008, 03:58 PM
shravan
Thanks, Barbara. That helped.


7.7.03, Windows 7, SQL Server 2005
August 28, 2008, 09:04 AM
PBrightwell
do a search on RECAP along with subfoot.


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes