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     [SOLVED] ROW-TOTAL OF SPECIFIC COLUMN

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] ROW-TOTAL OF SPECIFIC COLUMN
 Login/Join
 
Gold member
posted
Hello all - I have hit just about every post out there trying to accomplish by goal, but just can't seem to get it to work. I am summing two fields (on a COMPUTE) ACROSS a field. I only want a row total for one of the fields but column totals for both. I'm also having trouble recomputing my compute. Here is what I have:
DEFINE FILE MYTABLE
COUNTER/I8=1;
END
TABLE FILE MYTABLE
SUM
COUNTER
COMPUTE CHG_PCT/D12.2% = ( ( COUNTER - LAST COUNTER ) / LAST COUNTER ) * 100;
BY 'HI_LEV' NOPRINT
BY 'REGION' AS 'Region'
ACROSS 'OPENWEEK'
ON HI_LEV RECOMPUTE MULTILINES AS 'Total For '
ON TABLE SUMMARIZE COUNTER CHG_PCT AS 'TOTAL'
END

Thanks all.

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


WF (App Studio) 8.2.01m / Windows
Mainframe FOCUS 8
 
Posts: 93 | Registered: February 20, 2008Report This Post
Virtuoso
posted Hide Post
Take a look at the multiverb functionality.
That will give you the ability to compute the row total for one specific field.

something like

DEFINE FILE MYTABLE
COUNTER/I8=1;
COUNTER2/I5=1;
END
TABLE FILE MYTABLE
SUM
COUNTER2
BY HI_LEV NOPRINT
BY REGION NOPRINT
SUM
COUNTER
COMPUTE CHG_PCT/D12.2% = ( ( COUNTER - LAST COUNTER ) / LAST COUNTER ) * 100;
BY 'HI_LEV' NOPRINT
BY 'REGION' AS 'Region'
ACROSS OPENWEEK
ON HI_LEV RECOMPUTE MULTILINES AS 'Total For '
ON TABLE SUMMARIZE COUNTER CHG_PCT AS 'TOTAL'
END



Now your "rowtotal" will be seen in the first column, but you can use it in a computed field after the across.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Gold member
posted Hide Post
Frank,
thanks for the quick response. I see how this works, but when I use it my column totals get goofed up. Totals show for only the COUNTER2 and the first column in the across for COUNTER. Still can't get my recompute to work for PCT_CHG.


WF (App Studio) 8.2.01m / Windows
Mainframe FOCUS 8
 
Posts: 93 | Registered: February 20, 2008Report This Post
Virtuoso
posted Hide Post
Bob

try to be a bit more specific on the field you do want a row total.
You can selective total one or more columns.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Gold member
posted Hide Post
I only want a row total on the COUNTER field I am defining. Not the CHG_PCT that I am computing. However, I would still like column totals for both and have CHG_PCT recompute since is a % calculation.

Like this:
week1 week2 week3 WEEK4 TOTAL
Region COUNTER CHG_PCT COUNTER CHG_PCT COUNTER CHG_PCT COUNTER CHG_PCT COUNTER
AAA 8 . 4 -50% 2 -50% 4 100% 18
BBB 1 . 1 0% 2 100% 6 200% 10
REGION TOT 9 . 5 -44% 4 -20% 10 150% 28

Thanks.


WF (App Studio) 8.2.01m / Windows
Mainframe FOCUS 8
 
Posts: 93 | Registered: February 20, 2008Report This Post
Virtuoso
posted Hide Post
Your (or mine) COUNTER2 is the same value as COUNTER so if you use the report as I suggested above the value of COUNTER2 should be the row sum of COUNTER.

After your code

...
ON TABLE SUMMARIZE COUNTER CHG_PCT AS 'TOTAL'
RECAP TOTCOUNT=C1; AS 'Total Counter'
END




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Expert
posted Hide Post
Can't use RECAP without a SUBFOOT, except in FML; this isn't FML...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Expert
posted Hide Post
1) lets you control which variable you want to handle as a row summary calculation:
TABLE FILE CAR
SUM SALES AS TOTSALES NOPRINT
BY CAR
SUM SALES COST ACROSS COUNTRY
AND COMPUTE MYSALESTOTAL/D8=C1;
BY CAR

double verbs and noprint

2) use ON TABLE COLUMN-TOTAL {fieldname(s)}
rather than SUMMARIZE, and it won't try to crank something it can't crank, just sums it up. so your % columns add to 100, if that's what they're s'posed to do.

is this what you wanted?
-s




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Virtuoso
posted Hide Post
Something like this perhaps?
DEFINE FILE MYTABLE
COUNTR1/I8=1;
COUNTR2/I8=1;
END
TABLE FILE MYTABLE
SUM COUNTR1 NOPRINT
BY 'HI_LEV' 
SUM COUNTR2
COMPUTE CHG_PCT/D12.2% = IF HI_LEV NE LAST HI_LEV THEN 0 ELSE
                         ( ( COUNTR2 - LAST COUNTR2 ) / LAST COUNTR2 ) * 100;
BY 'HI_LEV' 
ACROSS 'OPENWEEK'
COMPUTE TOTCOL/I8 = C1 ; AS 'Total'
ON TABLE SUBTOTAL AS 'Total'
END  

Hope this helps ...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Gold member
posted Hide Post
susannah,
the following worked for me:
DEFINE FILE TABLE1
COUNTER/I8=1;
COUNT_TOT/I8=1;
END
TABLE FILE TABLE1
SUM
COUNT_TOT NOPRINT AS 'COUNT_TOT'
BY HI_LEV' NOPRINT
BY REGION' AS 'Region'
SUM
COUNTER/I8C AS 'Accts Opnd'
COMPUTE CHG_PCT/D12% = IF OPENWEEK EQ 'February 2, 2009' THEN 0 ELSE ( ( COUNTER - LAST COUNTER ) / LAST COUNTER ) * 100;
AS 'Pct Chg,Prior Week'
BY HI_LEV' NOPRINT
BY REGION' AS 'Region'
ACROSS 'DDA_ACCT_HIGH_ACTV.DDA_ACCT_HIGH_ACTV.OPENWEEK' AND COMPUTE COUNT_TOTAL/I8 = C1; AS 'Total Accts Opnd'
ON HI_LEV SUBTOTAL AS 'Totals for '
ON TABLE COLUMN-TOTAL AS 'GRAND TOTAL' COUNTER CHG_PCT

The RECOMPUTE is not working as hoped. It should recompute CHG_PCT by my calculation at the COLUMN-TOTAL:
REGION WEEK1 WEEK2 WEEK3 TOTAL
COUNTER | CHG_PCT | COUNTER | CHG_PCT | COUNTER | CHG_PCT | COUNTER
AAAA 10 | 0 | 5 | -50% | 2 | -60% | 17
BBBB 7 | 0 | 9 | 28% | 11 | 22% | 27
TOTAL 17 | 0 | 14 | -17% | 13 | -7% | 44

I've tried all combinations of RECOMPUTE and just can't get it to work. But the row total issue I was having is solved. Thanks to all who took the time to respond.
Smiler
BobV

quote:
Originally posted by susannah:
1) lets you control which variable you want to handle as a row summary calculation:
TABLE FILE CAR
SUM SALES AS TOTSALES NOPRINT
BY CAR
SUM SALES COST ACROSS COUNTRY
AND COMPUTE MYSALESTOTAL/D8=C1;
BY CAR

double verbs and noprint

2) use ON TABLE COLUMN-TOTAL {fieldname(s)}
rather than SUMMARIZE, and it won't try to crank something it can't crank, just sums it up. so your % columns add to 100, if that's what they're s'posed to do.

is this what you wanted?
-s


WF (App Studio) 8.2.01m / Windows
Mainframe FOCUS 8
 
Posts: 93 | Registered: February 20, 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     [SOLVED] ROW-TOTAL OF SPECIFIC COLUMN

Copyright © 1996-2020 Information Builders