Focal Point
[Solved] Weighted Average calculation on total line

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

June 22, 2012, 06:37 AM
sladkat
[Solved] Weighted Average calculation on total line
Hi,
I want total of a count and weighted calculation of age to be on the total line.
Please find below a query similar to my request.

TABLE FILE CAR
SUM
CNT.SEATS
AVE.WHEELBASE
BY CAR
WHERE CAR IN ('TOYOTA', 'BMW', 'AUDI')
ON TABLE SUBTOTAL SUM. SEATS AVE. WHEELBASE
END

RESULT:
CAR CNT WHEELBASE
AUDI 1 105.3
BMW 6 102.7
TOYOTA 1 93.3
TOTAL 8 100.4

Here on the total line I am getting a total of count of seats and average of average of wheelbase. Instead I want to get total of count of seats and weighted average of wheelbase on the total line.
Is there any formula to calculate weighted average on subtotal? or any other way to achieve the requirement.

Please help. Confused

This message has been edited. Last edited by: Kathleen Butler,


Supriya
WF 7.7.02/8.0
June 22, 2012, 07:05 AM
Danny-SRL
Sladkat,

How do you define your weighted average?
I would use a COMPUTE instead of AVE and do RECOMPUTE instead of a SUBTOTAL.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

June 22, 2012, 07:08 AM
j.gross
 TABLE FILE CAR
SUM
  CNT.SEATS
  SUM.WHEELBASE AS SUM,WHEELBASE NOPRINT
  COMPUTE AVG/D10.2=SUM.WHEELBASE/CNT.SEATS; AS 'AVE,WHEELBASE'
BY CAR
WHERE CAR IN ('TOYOTA', 'BMW', 'AUDI')
ON TABLE SUMMARIZE
END
 

June 25, 2012, 01:08 AM
sladkat
It worked... Thanks a lot Smiler


Supriya
WF 7.7.02/8.0