Focal Point
[SOLVED] Weighted Averages at the Sub Total level

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

December 07, 2015, 05:24 PM
Dave H.
[SOLVED] Weighted Averages at the Sub Total level
Looking to do a Weighted Average at a sub group level. Searched the forum and see there are many suggestions to use RECAP and SUBFOOT. I have worked through some basic examples but now have my self in a knot with the real-life code and business report.

In short, I am creating a report that groups data by Machine, the Product being produced and reports the machine run Duration and target speed.
Then for each machine summarize the individual data, report the total run Duration and the Weighted Target Speed based on the run Duration for each Product by Machine.

Below is an example of what I am try to code.
'Machine' and 'Product' are 'BY' fields. 'Duration' and 'Target_Speed' are Aggregate fields.
The report needs to summarized data by 'Work Center'.


Machine Product Duration Target_Speed
1 A 100 1700
B 300 2000
Machine Totals: 1 400 1925 (Weighted Tgt Speed)


2 c 100 2000
D 200 1500
E 400 1000
Machine Totals: 2 700 1270 (Weighted Tgt Speed)

I have tried RECAP and SUBFOOT but calculates duration totals for the entire report (i.e. 1100) and applies that value to each machine.
I need to get the total duration for each machine and the 'Weighted Target Speed; based on the duration factor and target speed for the products produced on each specific machine.

Any suggestions or examples would be appreciated? Thanks.

This message has been edited. Last edited by: Dave H.,


WebFOCUS 8.009
Windows, All Outputs
December 08, 2015, 06:47 AM
Danny-SRL
This should do it:
  
TABLE ...
BY MACHINE
BY PRODUCT
PRINT DURATION TARGET_SPEED 
COMPUTE PTDS/D6c=DURATION * TARGET_SPEED; NOPRINT
ON MACHINE RECAP WTS/D6c=PTDS / DURATION;
ON MACHINE SUBFOOT
"<WTS " 



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