I have a report that looks at charges by year for the last three years. However, I have the years in the across column. I need to add a column at the end that contains a compute statement. I've reviewed the forum and have found many references to ROW-TOTAL, SUMMARIZE, and COMPUTE, but I can't seem to get them to fit. In the end it should look like this:
---------|--2013-|-2014-|-2015-|-Variance ---------|---------------------------- Company A|---$$--|--$$--|--$$--|--##.#% Company B|---$$--|--$$--|--$$--|--##.#% Company C|---$$--|--$$--|--$$--|--##.#% Company D|---$$--|--$$--|--$$--|--##.#% Company E|---$$--|--$$--|--$$--|--##.#%
Where the Variance is
Variance/D6.1%B= (((2015-2014)/2014) * 100)
Currently, in the code posted I get all the columns, however, my variance shows .0% .
Part of my dilemma is in the examples I've found there are obvious seperate columns in the calculations, where as, in my example, I'm working with one column. Should I be approaching this from a different angle?
Any advice would be appreciated!!
Thanks, Pondog App Studio
-INCLUDE IBFS:/WFC/Repository/TonyTest/PFSKPIs/pfs_getdate_vars.fex
-SET ECHO = ALL
-DEFAULTH &FM=' '
-DEFAULTH &VPSTPDFY = ' '
-DEFAULTH &VPOSTPER = ' '
-DEFAULTH &CFY = ' '
-DEFAULTH &PFY = ' '
-READFILE PFSRPTPD
-SET &CFY = '&CFY.EVAL'; -* this is 2015
-SET &PFY = '&PFY.EVAL'; -* this is 2014
TABLE FILE PFSAR
SUM
PFSAR.PFSAR.CHARGES/P11C AS ''
BY LOWEST PFSAR.PFSAR.ARTYPDESC AS ''
ACROSS LOWEST PFSAR.PFSAR.PSTPDFY AS ''
COMPUTE Variance/D6.1%B= (((&CFY-&PFY)/&PFY) * 100) ; AS 'Variance'
WHERE PFSAR.PFSAR.CHARGES NE 0;
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = IBFS:/WFC/Repository/Branding/np_gphc_theme.sty,
$
TYPE=REPORT,
CALC-LOCATION=TOP,
$
TYPE=REPORT,
OBJECT=STATUS-AREA,
JUSTIFY=LEFT,
PAGE-LOCATION=BOTTOM,
$
ENDSTYLE
END
This message has been edited. Last edited by: Pondog,
WebFOCUS 8.1.05 Windows, All Outputs
December 28, 2015, 03:10 PM
Danny-SRL
This should do it:
TABLE FILE GGSALES
SUM DOLLARS
BY CATEGORY
ACROSS ST
COMPUTE VAR/D12.2=(C3-C2)/C2*100;
IF ST EQ CA OR CT OR FL
END
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
December 28, 2015, 04:01 PM
Pondog
Hey Danny-SRL
I've looked everywhere to try an find out how I call a column. I used COL1, COL2, etc, COLUMN1, COLUMN2, etc. I never thought it would be as simple as C1, C2, etc. Thanks a bunch!!
WebFOCUS 8.1.05 Windows, All Outputs
December 28, 2015, 04:31 PM
Pondog
Ok, to me this is weird; but I'm sure it has something to do with the way I have the fex set up.
When looking at the results from
COMPUTE VAR/D12.2=(C3-C2)/C2*100;
I found the results were from the years 2014 and 2013, not 2015 and 2014. I tried changing the columns but then came up with a .0% Variance when I shifted the column numbers left or right by one. I had to look at the individual columns to see what what going on and found that the report produces 6 columns; two for each year, yet only shows one column for each year. I've found that Columns 1 + 2 refer to year 2013; Columns 3 + 4 refer to year 2014, and Columns 5 + 6 refer to year 2015. Again; weird.
WebFOCUS 8.1.05 Windows, All Outputs
December 28, 2015, 10:55 PM
Danny-SRL
Not weird. It is your object PFSAR.PFSAR.CHARGES/P11C. The format doubles it.
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF