Focal Point
[CLOSED] Calculating PCT for a rowtotal

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

December 29, 2009, 05:10 AM
philippe@Nantes
[CLOSED] Calculating PCT for a rowtotal
Hi everybody, I hope you an happy new year. For me it will be a wel started year if I can have some help for this problem.
So, I would like to calculate the PCT.ROWTOTAL equivalence.
I'm in an across statement and i have to print de row-total and the row-total percent vs total report of this rowtotal

I tried this :
TABLE FILE TDWNFDLF
SUM
NB_ACV AS 'NB de Ventes'
ROW-TOTAL
PCT.ROW-TOTAL/D12.2%
BY LIB_OFF_AGG AS 'OFFRE AGR'
ACROSS SEMAINE2 AS ''
END

This message has been edited. Last edited by: Kerry,


WebFocus thru Dev Studio version 7.6.11
Dev Studio on Windows Xp, Webfocus Client on UNIX basing on TOMCAT and DB2,
Reporting Server on MVS , USS and on UNIX
December 29, 2009, 07:24 AM
Dan Satchell
Here is one approach using a multi-verb request:

TABLE FILE TDWNFDLF
SUM NB_ACV NOPRINT
BY LIB_OFF_AGG AS 'OFFRE AGR'
SUM NB_ACV AS 'NB de Ventes'
AND COMPUTE PCT_NB_ACV/D12.2% = NB_ACV/C1*100 ; AS '%'
BY LIB_OFF_AGG AS 'OFFRE AGR'
ACROSS SEMAINE2 AS ''
ON TABLE ROW-TOTAL
END


OR a simpler approach using verb prefix RPCT:

TABLE FILE TDWNFDLF
SUM NB_ACV AS 'NB de Ventes'
RPCT.NB_ACV/D12.2% AS '%
BY LIB_OFF_AGG AS 'OFFRE AGR'
ACROSS SEMAINE2 AS ''
ON TABLE ROW-TOTAL
END

This message has been edited. Last edited by: Dan Satchell,


WebFOCUS 7.7.05
December 29, 2009, 08:06 AM
philippe@Nantes
Thank's Dan for your reply, but it's not exactely what I want.
At the end of the row I have to print first the row-total and then the PCT of this row-total vs the total of all row-total.
Is there one way to designate the row-total cell and his TOT. value.
Peharps it's not possible at all.


WebFocus thru Dev Studio version 7.6.11
Dev Studio on Windows Xp, Webfocus Client on UNIX basing on TOMCAT and DB2,
Reporting Server on MVS , USS and on UNIX
December 29, 2009, 06:18 PM
Dan Satchell
I believe this code will generate the output you want, but the vertical positioning of the headings for the TOTALS and % columns may not be ideal.

TABLE FILE TDWNFDLF
 SUM NB_ACV NOPRINT
 SUM NB_ACV NOPRINT
  BY LIB_OFF_AGG AS 'OFFRE AGR'
 SUM NB_ACV AS 'NB de Ventes'
  BY LIB_OFF_AGG AS 'OFFRE AGR'
  ACROSS SEMAINE2 AS ''
  COMPUTE TOT_NB_ACV/D12.2 = C2 ; AS 'TOTALS'
  COMPUTE PCT_NB_ACV/D12.2% = C2/C1*100 ; AS '%'
END



WebFOCUS 7.7.05
December 30, 2009, 09:50 AM
Guy
I didn't try this on a report with an across but you may want to try this and see if it gives you what you want.... the WITHIN gives you percentages on each row as well as the percent on intermediate subtotals.

TABLE FILE TDWNFDLF
SUM
NB_ACV AS 'NB de Ventes'
ROW-TOTAL
PCT.ROW-TOTAL/D12.2% WITHIN LIB_OFF_AGG AS ''
BY LIB_OFF_AGG AS 'OFFRE AGR'
ACROSS SEMAINE2 AS ''
END


WebFOCUS 7.6.4
Windows XP against an Oracle Database mainly SCT Banner Higher Education ODS and EDW
Various output formats


Guy Brenckle
Budget Analyst
University of Northern Colorado