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]Subtotal and grandtotal - Issue(Not getting the correct results)

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED]Subtotal and grandtotal - Issue(Not getting the correct results)
 Login/Join
 
Guru
posted
Hi,

I have the below code wherein I need to get the subtotal and the grandtotal but Iam not getting the desired result (It is not summing up the values correctly).

Below is the code:
-SET &ECHO='ALL';
-DEFAULT &STATE_SEL='AL,AZ,CO,ID';
-TYPE &STATE_SEL

-* Convert ' OR ' to ', ' in the parameter list
-SET &STATE_SEL = STRREP (&STATE_SEL.LENGTH, &STATE_SEL, 4, ' OR ', 2, ', ', &STATE_SEL.LENGTH, 'A&STATE_SEL.LENGTH');
-TYPE &STATE_SEL

SQL SQLORA PREPARE REPORT FOR
SELECT * FROM SCHM1.TABLE1;
END

TABLE FILE BIWK_RPT_ACO
SUM
CNT_IF_3_65 AS '15-JUL-16'
CNT_IF_3_80 AS '29-JUL-16'
CNT_IF_3_90 AS '12-AUG-16'
CNT_IF_YTD_90 AS 'YTD_AVG'
BY DIVISION 
BY REGION 
BY STATE
BY DATA AS 'Data'
WHERE STATE IN (&STATE_SEL)
N DIVISION SUBTOTAL CNT_IF_3_65 CNT_IF_3_80 CNT_IF_3_90 CNT_IF_YTD_90 
ON TABLE PCHOLD FORMAT EXL07
END  


This is the o/p which I get when I run the report :
Division Region STATE Data 15-Jul-16 29-Jul-16 12-Aug-16 YTD AVG 2016
EAST E AL % Congestion 14.36% 3.84% 3.96% 4.54%
% Congestion w/o AB 4.69% 0.37% 0.51% 0.59%
Congestion 193 52 54 61
Congestion w/o AB 63 5 7 8
Polled Units 1,344 1,353 1,364 1,336
*TOTAL DIVISION EAST 1,344 1,353 1,364 1,336
WEST MTW AZ % Congestion 2.45% 0.91% 0.83% 0.99%
% Congestion w/o AB 1.91% 0.57% 0.55% 0.62%
Congestion 227 84 77 91
Congestion w/o AB 177 53 51 57
Polled Units 9,250 9,247 9,245 9,163
CO % Congested 3.23% 1.32% 1.29% 1.45%
% Congested w/o PE 2.17% 0.55% 0.56% 0.64%
Congested 394 164 179 161
Congested w/o PE 264 68 78 71
Polled Units 12,193 12,451 13,834 11,117
W ID % Congestion 6.88% 2.49% 2.53% 3.20%
% Congestion w/o AB 4.45% 0.82% 0.81% 1.24%
Congestion 153 55 56 70
Congestion w/o AB 99 18 18 27
Polled Units 2,223 2,207 2,210 2,178
*TOTAL DIVISION WEST 2,223 2,207 2,210 2,178
TOTAL 2,223 2,207 2,210 2,178


This is the output which Iam expecting but not able to get it:

Division Region STATE Data 15-Jul-16 29-Jul-16 YTD AVG 2016
EAST E AL % Congestion 14.36% 3.84% 4.54%
% Congestion w/o AB 4.69% 0.37% 0.59%
Congestion 193 52 61
Congestion w/o AB 63 5 8
Polled Units 1,344 1,353 1,336
*TOTAL DIVISION EAST %Congestion Total 14.36% 3.84% 4.54%
%Congestion w/o AB Total 4.69% 0.37% 0.59%
Congestion Total 193 52 61
Congestion w/o AB Total 63 5 8
Polled Units Total 1,344 1,353 1,336
WEST MTW AZ % Congestion 2.45% 0.91% 0.99%
% Congestion w/o AB 1.91% 0.57% 0.62%
Congestion 227 84 91
Congestion w/o AB 177 53 57
Polled Units 9,250 9,247 9,163
CO % Congestion 3.23% 1.32% 1.45%
% Congestion w/o AB 2.17% 0.55% 0.64%
Congestion 394 164 161
Congestion w/o AB 264 68 71
Polled Units 12,193 12,451 11,117
W ID % Congestion 6.88% 2.49% 3.20%
% Congestion w/o AB 4.45% 0.82% 1.24%
Congestion 153 55 70
Congestion w/o AB 99 18 27
Polled Units 2,223 2,207 2,178
*TOTAL DIVISION WEST %Congestion Total 0.0628*100 0.0236*100 2.82*100
%Congestion w/o AB Total 0.04265*100 0.97*100 1.25*100
Congestion Total 774 303 322
Congestion w/o AB Total 540 139 155
Polled Units Total 23,666 23,905 22,458
Grand Total %Congestion Total 10.32% 3.10% 3.68%
%Congestion w/o AB Total 4.48% 0.67% 0.92%
Congestion Total 967 355 383
Congestion w/o AB Total 603 144 163
Polled Units Total 25,010 25,258 23,794


Could anyone please let me know how to get this done and any solutions/suggestions are appreciated.
Thanks a lot in advance!

Regards,
IP

This message has been edited. Last edited by: <Emily McAllister>,


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
 
Posts: 270 | Registered: October 30, 2014Report This Post
Virtuoso
posted Hide Post
Is there a reason why you send an SQL Passthru of SELECT * to Oracle first? I'm not sure how that relates to the TABLE FILE request.

You may want to look up RECOMPUTE and SUMMARIZE in the documentation. If you're subtotaling percent and/or average values, you have to use them instead to get the totals not to just add the columns up.

TABLE FILE CAR
SUM DEALER_COST
RETAIL_COST
COMPUTE RATE/D12.2%=DCOST/RCOST*100;
BY COUNTRY RECOMPUTE AS 'Subtotal:'
BY CAR
ON TABLE PCHOLD FORMAT HTML
ON TABLE RECOMPUTE 
END


If you don't use RECOMPUTE, it'll just add up the RATE for each COUNTRY which is incorrect.

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


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Guru
posted Hide Post
Hi,

I have used the connection string to connect to the Oracle DB but I have missed copy pasting that section here in the code.

I need the totals at a divisional level by doing a sum of the all these individual ones under the Data column and also doing a average for the percent columns.

Could you please provide any sample example for the same?

Thanks a lot in advance for your help.

Regards,
IP


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
 
Posts: 270 | Registered: October 30, 2014Report This Post
Guru
posted Hide Post
This is the o/p which I need to get(Expecting result):

Division Region State Data 15-JUL-16 29-JUL-16 YTD AVG 2016
EAST E AL %Congest 14.36% 3.84% 4.54%
%Congest W/o AB 4.69% 0.37% 0.59%
Congest 193 52 61
Congest w/o AB 63 5 8
Polledunits 1344 1353 1336

Total Division East %Congest Total 14.36% 3.84% 4.54%
%Congest 4.69% 0.37% 0.59%
Congest 193 52 61
Congest w/o AB 63 5 8
Polledunits 1344 1353 1336

WEST MTW AZ %Congest 2.45% 0.91% 0.99%
%Congest w/o AB 1.91% 0.57% 0.62%
Congest 227 84 91
Congest w/0 AB 177 53 57
Polledunits 9250 9247 9163

CO %Congest 3.23% 1.32% 1.45%
%Congest w/o AB 2.17% 0.55% 0.64%
Congest 394 164 161
Congest w/0 AB 264 68 71
Polledunits 12193 12451 11117

w ID %Congest 6.88% 2.49% 3.20%
%Congest w/o AB 4.45% 0.82% 1.24%
Congest 153 55 70
Congest w/0 AB 99 18 27
Polledunits 2223 2207 2178

Total Division West %Congest Total 6.28% 2.36% 2.82%
%Congest 4.26% 0.97% 1.25%
Congest 774 303 322
Congest w/o AB 540 139 155
Polledunits 23666 23905 22458

Grand total %Congest Total 10.32% 3.10% 3.68%
%Congest 4.48% 0.67% 0.92%
Congest 967 355 383
Congest w/o AB 603 144 163
Polledunits 25010 25258 23794

Can anyone please let me know any solutions to get the above result.

Thanks a lot!

Regards,
IP


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
 
Posts: 270 | Registered: October 30, 2014Report This Post
Virtuoso
posted Hide Post
You can't expect to subtotal percentages without knowledge of the weights (relative or absolute) of the summed values.

Babak's solution has the correct approach.

If that's not what you need, at least make an attempt to properly format your examples so that we might be able to see what you want. Hint: use the </> button in the toolbar.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Guru
posted Hide Post
 This is the o/p which I need to get(Expecting result):


Division 	Region 	State 	Data 			15-JUL-16 	29-JUL-16 	YTD AVG 2016
EAST 		E 	AL 	%Congest 		14.36% 		3.84% 		4.54%
				%Congest W/o AB 	4.69% 		0.37% 		0.59%
				Congest 		193 		52 		61
				Congest w/o AB 		63 		5 		8
				Polledunits 		1344 		1353 		1336

Total Division East 		%Congest Total 		14.36% 		3.84% 		4.54%
				%Congest 		4.69% 		0.37% 		0.59%
				Congest 		193 		52 		61
				Congest w/o AB 		63 		5 		8
				Polledunits 		1344 		1353 		1336

	
WEST 		MTW 	AZ 	%Congest 		2.45% 		0.91% 		0.99%
				%Congest w/o AB 	1.91% 		0.57% 		0.62%
				Congest 		227 		84 		91
				Congest w/0 AB 		177 		53 		57
				Polledunits 		9250 		9247 		9163


			CO 	%Congest 		3.23% 		1.32% 		1.45%
				%Congest w/o AB 	2.17% 		0.55% 		0.64%
				Congest 		394 		164 		161
				Congest w/0 AB 		264 		68 		71
				Polledunits 		12193 		12451 		11117

		w 	ID 	%Congest 		6.88% 		2.49% 		3.20%
				%Congest w/o AB 	4.45% 		0.82% 		1.24%
				Congest 		153 		55 		70
				Congest w/0 AB 		99 		18 		27
				Polledunits 		2223 		2207 		2178

Total Division West 		%Congest Total 		6.28% 		2.36% 		2.82%
				%Congest 		4.26% 		0.97% 		1.25%
				Congest 		774 		303 		322
				Congest w/o AB 		540 		139 		155
				Polledunits 		23666 		23905 		22458


Total for East &West		%Congest Total 		10.32% 		3.10% 		3.68%
				%Congest 		4.48% 		0.67% 		0.92%
				Congest 		967 		355 		383
				Congest w/o AB 		603 		144 		163
				Polledunits 		25010 		25258 		23794 


For the %'s( %Congest Total,%Congest )under the total ,the values should be the sum of the percentages divided by 2 and for the remaining ones(like
Congest,Congest w/o AB,Polledunits),it is the sum of the values.

Please let me know how to get this done.I tried subtotal,summarize and Iam not getting the above result which is expected.

But Babak's solution is not I need.This is the ouput which I need.

Could you or anyone please help me on this.

Thanks a lot in advance!

Regards,
IP 

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


Webfocus 8105 Developer studio,Windows 7,HTML,Excel,PDF,Text,Infoassist,Graph,AHTML
 
Posts: 270 | Registered: October 30, 2014Report 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]Subtotal and grandtotal - Issue(Not getting the correct results)

Copyright © 1996-2020 Information Builders