Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] OVER COLUMN PERCENTAGE COMPUTE

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] OVER COLUMN PERCENTAGE COMPUTE
 Login/Join
 
Guru
posted
I am trying to compute percentage for a column value as follows:


TABLE FILE AGG_ARBYSCHOOL
-*ON J0.DIM_SCHOOL.DIVISIONNAME SUBTOTAL AS 'DIVISIONTOTAL'
-*
-*ON J0.DIM_SCHOOL.DISTRICTNAME SUBTOTAL AS 'TOTAL'
-*ON J0.DIM_SCHOOL.DIVISIONNAME RECOMPUTE AS 'Division Total'
-*ON TABLE SET BYPANEL ON
-*ON TABLE COLUMN TOTAL OFF
SUM
'AGG_ARBYSCHOOL.AGG_ARBYSCHOOL.0TO6/I7' AS ''
'AGG_ARBYSCHOOL.AGG_ARBYSCHOOL.7TO13/I7' AS ''
'AGG_ARBYSCHOOL.AGG_ARBYSCHOOL.14TO20/I7' AS ''
'AGG_ARBYSCHOOL.AGG_ARBYSCHOOL.21TO27/I7' SKIP-LINE AS '' OVER
COMPUTE 0to6PCT/I7% = ( 0TO6 / TOT.0TO6 ) * 100; AS ''

COMPUTE 7to13PCT/I7% = ( 7TO13 / TOT.7TO13 ) * 100; AS ''
COMPUTE 14to20PCT/I7% = ( 14TO20 / TOT.14TO20 ) * 100; AS ''
COMPUTE 21to27PCT/I7% = ( 21TO27 / TOT.21TO27 ) * 100; AS ''
BY 'J0.DIM_SCHOOL.DIVISIONNAME' AS 'Division' RECOMPUTE
BY 'J0.DIM_SCHOOL.DISTRICTNAME' AS 'District' RECOMPUTE

ON J0.DIM_SCHOOL.DIVISIONNAME SUBTOTAL AS 'Total '
<\>

What am I doing wrong? I am trying to calculate percentage to show under the sum value and I would like to give my columns headers. If I add header it repates with every value. How can I accomplish this that I have header appearing once for the SUM column and % value goes under sum value, and all values are alligned?

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


WebFOCUS 7.6.10
Windows
HTML
 
Posts: 294 | Registered: March 04, 2010Report This Post
Virtuoso
posted Hide Post
Maybe something like this might be of help?
TABLE FILE CAR
SUM 
     DEALER_COST AS ''
     RETAIL_COST AS ''
OVER
     COMPUTE DCPCT/D7.2% = ( DEALER_COST / TOT.DEALER_COST ) * 100; AS ''
     COMPUTE RCPCT/D7.2% = ( RETAIL_COST / TOT.RETAIL_COST ) * 100; AS ''
BY   COUNTRY AS ''
BY   CAR     AS ''
ON TABLE SUBHEAD
"COUNTRY<+0>CAR<+0>DCOST<+0>RCOST"
ON TABLE NOTOTAL
ON TABLE SET STYLE *
TYPE=TABHEADING,
     HEADALIGN=BODY,
$
ENDSTYLE
END


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Expert
posted Hide Post
You need to code the column titles in the page heading and then use HEADALIGN=BODY:

TABLE FILE CAR
SUM
LENGTH AS ''
WIDTH AS ''
WHEELBASE AS ''
WEIGHT AS '' 

OVER

COMPUTE 1PCT/I7% = ( LENGTH / TOT.LENGTH ) * 100; AS ''
COMPUTE 2PCT/I7% = ( WIDTH / TOT.WIDTH ) * 100; AS ''
COMPUTE 3PCT/I7% = ( WHEELBASE / TOT.WHEELBASE ) * 100; AS ''
COMPUTE 4PCT/I7% = ( WEIGHT / TOT.WEIGHT ) * 100; AS ''

BY COUNTRY AS ''
BY CAR AS ''
BY MODEL AS ''

HEADING
"CAR REPORT"
"COUNTRY <+0> CAR <+0> MODEL <+0> LENGTH <+0> WIDTH <+0> WHEEL BASE <+0> WEIGHT"

ON TABLE SET STYLE *
TYPE=REPORT, FONT='ARIAL', SIZE=9, $
TYPE=HEADING, HEADALIGN=BODY, STYLE=BOLD, $
TYPE=HEADING, LINE=1, COLSPAN=7, $
END


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Guru
posted Hide Post
Thank you it was helpful code, but when I run it in my environment, My headings dont align with column data. It seems like this code only works with the grid on.

TABLE FILE AGGRIGATE_ENROLLMENT_VIEW_BV01
SUM
'AGGRIGATE_ENROLLMENT_VIEW_BV01.AGG_ENR.ENROLLEDACTIVE' AS ''
'AGGRIGATE_ENROLLMENT_VIEW_BV01.AGG_ENR.NEWENROLL' AS '' OVER
COMPUTE 3PCT/I7% = ( ENROLLEDACTIVE / TOT.ENROLLEDACTIVE) * 100; AS ''
COMPUTE 3PCT/I7% = ( NEWENROLL / TOT.NEWENROLL) * 100; AS ''
BY 'AGGRIGATE_ENROLLMENT_VIEW_BV01.SCHOOL.DIVISIONNAME' AS ''
BY 'AGGRIGATE_ENROLLMENT_VIEW_BV01.SCHOOL.DISTRICTNAME' AS ''
HEADING
"Enrollment Test"
"DIVISION<+5> DISTRICT<+5> ENROLLED<+5> NEWENROLLE"

FOOTING
""
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=9,
$
TYPE=TITLE,
STYLE=BOLD,
$
TYPE=TABHEADING,
SIZE=12,
STYLE=BOLD,
LINE=1, COLSPAN=7,
HEADALIGN=BODY,
$
TYPE=TABFOOTING,
SIZE=12,
STYLE=BOLD,
$
TYPE=HEADING,
SIZE=12,
STYLE=BOLD,
$
TYPE=FOOTING,
SIZE=12,
STYLE=BOLD,
$
TYPE=SUBHEAD,
SIZE=10,
STYLE=BOLD,
$
TYPE=SUBFOOT,
SIZE=10,
STYLE=BOLD,
$
TYPE=SUBTOTAL,
BACKCOLOR=RGB(210 210 210),
$
TYPE=ACROSSVALUE,
SIZE=9,
$
TYPE=ACROSSTITLE,
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
BACKCOLOR=RGB(210 210 210),
STYLE=BOLD,
$
ENDSTYLE
END

Is there anything I can do to align my columns heading with the data?


WebFOCUS 7.6.10
Windows
HTML
 
Posts: 294 | Registered: March 04, 2010Report This Post
Guru
posted Hide Post
Try adding "IN col"

quote:
TABLE FILE AGGRIGATE_ENROLLMENT_VIEW_BV01
SUM
'AGGRIGATE_ENROLLMENT_VIEW_BV01.AGG_ENR.ENROLLEDACTIVE' AS '' IN 1
'AGGRIGATE_ENROLLMENT_VIEW_BV01.AGG_ENR.NEWENROLL' AS '' IN 20 OVER
COMPUTE 3PCT/I7% = ( ENROLLEDACTIVE / TOT.ENROLLEDACTIVE) * 100; AS '' IN 1
COMPUTE 3PCT/I7% = ( NEWENROLL / TOT.NEWENROLL) * 100; AS '' IN 20
BY 'AGGRIGATE_ENROLLMENT_VIEW_BV01.SCHOOL.DIVISIONNAME' AS ''
BY 'AGGRIGATE_ENROLLMENT_VIEW_BV01.SCHOOL.DISTRICTNAME' AS ''


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] OVER COLUMN PERCENTAGE COMPUTE

Copyright © 1996-2020 Information Builders