August 27, 2008, 12:55 PM
shravanGrand 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.
). Can somebody please help me in this ?
Thanks.
Shravan
August 27, 2008, 01:44 PM
BarbaraAYou 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!
August 27, 2008, 03:58 PM
shravanThanks, Barbara. That helped.
August 28, 2008, 09:04 AM
PBrightwelldo a search on RECAP along with subfoot.