[SOLVED] Averages and Calculations when using Across
I am working with the following:
TABLE FILE V_PREBUY_PIVOT SUM SALES_VOLUME_LBS BY MATERIAL_GROUP BY MATERIAL_GROUP_DESC BY SOLD_TO_NAME BY SHIP_TO_CITY BY QTY_SHIPPED BY OPEN_ORDER_LBS ACROSS BOOK_MONTH AS '' ON TABLE SUBHEAD "PreBuy Info" FOOTING "&TDATE" WHERE MATERIAL_GROUP EQ 'PT' AND (BOOK_MONTH EQ '200807' OR BOOK_MONTH EQ '200808' OR BOOK_MONTH EQ '200809'); ON TABLE SET NODATA '' ON TABLE SET PAGE-NUM OFF ON TABLE ROW-TOTAL AS 'TOTAL' ON TABLE NOTOTAL ON TABLE PCHOLD FORMAT HTML ON TABLE SET HTMLCSS ON ON TABLE SET STYLE *
BOOK_MONTH will be an parameter by user. I need a ROW for the AVERAGE of SALES_VOLUME_LBS at the end and the following:
Does anyone have any suggestions?This message has been edited. Last edited by: Kerry,
WebFOCUS 7.6.2 client WebFOCUS 7.6.0 server Windows 2000 and 2003 Server. Windows XP Professional for Dev Studio Output: HTML, Excel, and PDF
June 11, 2009, 05:53 PM
GamP
Right after your across you can put in one or more COMPUTE statements. These can access any column in the report. This BOOK_MONTH parameter however controls how many columns there will be and thus also how to reference them and how to calculate the average of sales. What you might do is introduce a multi-verb request. The first part of the request would then calculate the avg of sales for the given months by all other fields (except the across) - NOPRINT. The second part of the request will then contain the normal sum by all fields, this time including the across, after which you can do your computes. So:
TABLE FILE xxxx
SUM AVG.SALES NOPRINT
BY
BY
BY
SUM SALES
BY
BY
BY
ACROSS
COMPUTE RT1/D12.2 = QTY_SHIPPED + OPEN_ORDER_LBS;
COMPUTE RT2/D12.2 = (QTY_SHIPPED + OPEN_ORDER_LBS) - C1;
C1 in this case is the very first column, not counting the BY's. This should give you more or less what you're looking for.