Focal Point
Help with compute ?

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

June 08, 2004, 04:35 PM
Stephen
Help with compute ?
I am having trouble with computes. I am new to webfocus and am wrote up the code below. I am trying to calculate some per capita type figures at a summary level. The source data is at the customer detail level and the report is one level higher at the country level. The 'sales per customer' calculation is working fine (it is based on the two summary fields). The calculations based on a summary field and a group by field are not coming out right. Any thoughts ?


DEFINE FILE TEMP
COUNTER/D12 = 1;
END
-*
TABLE FILE TEMP
SUM
COUNTER AS ' Customers '
AND IVC_NET_AMT_USD_TY AS ' Net Sales (USD) - This Fiscal Year (YTD) '

COMPUTE CUSTPERCAP/D12 = (COUNTER / BSEX) ; AS ' Customers per Capita '

COMPUTE SALESPERCAP/D12 = (IVC_NET_AMT_USD_TY / BSEX ) ; AS ' Sales per Capita '

COMPUTE SALESPERCUST/D12 = (IVC_NET_AMT_USD_TY / COUNTER); AS ' Sales per Customer '

BY
DIVISION
BY
BILL_TO_GB_COUNTRY AS ' Country '
BY
BSEX AS ' Population '
-*
ON DIVISION SUBTOTAL
COUNTER
IVC_NET_AMT_USD_TY AS '*TOTAL'
June 08, 2004, 04:50 PM
mgrackin
Change your ON DIVISION SUBTOTAL statement to ON DIVISION RECOMPUTE.

SUBTOTAL and SUB-TOTAL do the computes first and then add the vlues in the computed column to get the total.

RECOMPUTE and SUMMARIZE will add the values in the columns first and then apply the computations to the total values in the TOTAL row to get the computed column value for the TOTAL row. I hope this makes sense. It's hard to word the explanation well.