Focal Point
COMPUTED Fileds ON SUBTOTAL

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

August 11, 2004, 06:32 PM
Lloyd
COMPUTED Fileds ON SUBTOTAL
Hey evryone, I am working on a report where I want to have my computed fields recalculated at the subtotal and total breaks.
Below is the code I was attempting to use but it doesn't quite work, it(commented lines) puts the computed values on separate lines follwing the data. They should be every fourth and fifth column on the subtotal line. Any one know how to make this work?



ON PARENT SUBTOTAL TY_WTD PL_WTD LY_WTD TY_MTD PL_MTD LY_MTD TY_STD PL_STD LY_STD TY_WES PL_WES LY_WES AS 'TOTAL SALES:'
-*ON PARENT COMPUTE PL%/D5.2 = IF TY_WTD NE 0 THEN ABS(TY_WTD - PL_WTD) / PL_WTD * 100 ELSE 0; AS ' '
-*ON PARENT COMPUTE LY%/D5.2 = IF LY_WTD NE 0 THEN ABS(TY_WTD - LY_WTD) / LY_WTD * 100 ELSE 0; AS ' '
ON TABLE COLUMN-TOTAL AS 'GRAND TOTAL:' TY_WTD PL_WTD LY_WTD TY_MTD PL_MTD LY_MTD TY_STD PL_STD LY_STD TY_WES PL_WES LY_WES

This message has been edited. Last edited by: <Mabel>,
August 11, 2004, 06:57 PM
<Pietro De Santis>
Check out SUMMARIZE and RECOMPUTE in the manual.

Recalculating Values for Subtotal Rows

You can use the SUMMARIZE and RECOMPUTE commands instead of SUB-TOTAL and
SUBTOTAL to recalculate the result of a COMPUTE command. SUMMARIZE is similar to
SUB-TOTAL in that it recomputes values at every sort break. RECOMPUTE is similar to
SUBTOTAL in that it recalculates only at the specified sort break.
August 12, 2004, 04:00 PM
Lloyd
Thanks Pietro, yet again you saved me.