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;
TABLE FILE TEMP
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 '
BILL_TO_GB_COUNTRY AS ' Country '
BSEX AS ' Population '
ON DIVISION SUBTOTAL
IVC_NET_AMT_USD_TY AS '*TOTAL'
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.
|Powered by Social Strata|