Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Go
New
Search
Notify
Tools
Reply
  
Help with compute ?
 Login/Join
 
Silver Member
posted
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'
 
Posts: 38 | Registered: May 20, 2004Reply With QuoteReport This Post
Virtuoso
posted Hide Post
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.
 
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003Reply With QuoteReport This Post
  Powered by Social Strata  
 


Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.