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     Computing a Percentage of Subtotal

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Computing a Percentage of Subtotal
 Login/Join
 
Gold member
posted
I have a report that is calculating the total hours worked by store number and by region, group and district. I want to be able to add a column on the report that shows what the % of the total hours for each group that store is in.

I can't figure out how to add the computed field to determine the percentage of the total for the group on each store line.


Here is my code:

TABLE FILE T_PROD_LABTRANS
SUM
REGULARHRS
BY REGION
BY BSTGROUP
BY BSTDIST
BY SITEID

ON BSTGROUP SUBTOTAL AS 'TOTAL FOR GROUP '
WHERE ( ENTERDATE GE DT(2007-02-04 00:00:00) ) AND ( ENTERDATE LE DT(2007-08-08 00:00:00) ) AND ( CRAFT EQ 'BSTTECH' ) AND ( SITEID NOT LIKE 'S-%' );
WHERE TOTAL REGULARHRS NE .00;
ON TABLE SET PAGE-NUM OFF
ON TABLE SET BYDISPLAY ON
ON TABLE SET EXPANDABLE ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT EXL2K FORMULA
ON TABLE SET COMPOUND 'BYTOC 2'


Rob M.
Target Corporation

WF 7.1.4
 
Posts: 73 | Location: Minneapolis, MN | Registered: August 08, 2007Report This Post
Platinum Member
posted Hide Post
Hi Rob,

Here's an example using the CAR file.

-*
SET ASNAMES = ON
-*
TABLE FILE CAR
SUM
SALES AS 'CAR_SALES'
BY COUNTRY
BY CAR
SUM
SALES AS 'BT_SALES'
BY COUNTRY
BY CAR
BY MODEL
BY BODYTYPE
ON TABLE HOLD AS HLD_SUM1 FORMAT ALPHA
END
-*
? HOLD HLD_SUM1
-*
DEFINE FILE HLD_SUM1
BT_PCT/D6.1% = (BT_SALES / CAR_SALES) * 100;
END
-*
TABLE FILE HLD_SUM1
PRINT
BT_SALES
BT_PCT
BY COUNTRY
BY CAR
BY CAR_SALES
BY MODEL
BY BODYTYPE
ON CAR SUBFOOT
" "
END

Jim


WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
 
Posts: 118 | Location: Lincoln Nebraska | Registered: May 04, 2005Report This Post
Expert
posted Hide Post
Hi Rob,

Did you get a chance to try Jim's suggestion? Many thanks to Jim's help. Smiler

Please try the following code as well:

DEFINE FILE CAR
RETAIL2/D6=RETAIL_COST;
END
 
TABLE FILE CAR
SUM RETAIL2 NOPRINT
BY COUNTRY
SUM RETAIL_COST
    COMPUTE TOTINCOUNTRY/D10.4=100 * RETAIL_COST / RETAIL2;
BY COUNTRY SUBTOTAL
BY CAR
BY MODEL
ON TABLE NOTOTAL
END


The DEFINE for RETAIL2 is to create a unique fieldname to use in the COMPUTE.

The following online document may be of interest as well:
Computing a Percentage of Subtotal

Hope this helps. Big Grin

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
 
Posts: 1948 | Location: New York | Registered: November 16, 2004Report This Post
Gold member
posted Hide Post
quote:
Originally posted by kerry:
Hi Rob,

Did you get a chance to try Jim's suggestion? Many thanks to Jim's help. Smiler

Please try the following code as well:

DEFINE FILE CAR
RETAIL2/D6=RETAIL_COST;
END
 
TABLE FILE CAR
SUM RETAIL2 NOPRINT
BY COUNTRY
SUM RETAIL_COST
    COMPUTE TOTINCOUNTRY/D10.4=100 * RETAIL_COST / RETAIL2;
BY COUNTRY SUBTOTAL
BY CAR
BY MODEL
ON TABLE NOTOTAL
END


The DEFINE for RETAIL2 is to create a unique fieldname to use in the COMPUTE.

The following online document may be of interest as well:
Computing a Percentage of Subtotal

Hope this helps. Big Grin

Cheers,

Kerry


Kerry your way worked great! Thank you so much!

I really didn't want to mess around with the HOLD files, etc.

Thanks again!


Rob M.
Target Corporation

WF 7.1.4
 
Posts: 73 | Location: Minneapolis, MN | Registered: August 08, 2007Report This Post
Guru
posted Hide Post
Or... something like this should work depending on the release you are in. I don't know what release the command WITHIN came in.

 TABLE FILE CAR
SUM RETAIL_COST
    PCT.RETAIL_COST WITHIN CAR
BY COUNTRY SUBTOTAL RETAIL_COST
BY CAR
BY MODEL
ON TABLE NOTOTAL
END
 


ttfn, kp


Access to most releases from R52x, on multiple platforms.
 
Posts: 346 | Location: Melbourne Australia | Registered: April 15, 2003Report This Post
Virtuoso
posted Hide Post
WITHIN has been around for many, many years now. It is probably one of the most forgotten and under utilised pieces of powerful syntax.

Thank you Karen for reminding us.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Gold member
posted Hide Post
Wow Cool, I will have to remember WITHIN for next time.


Rob M.
Target Corporation

WF 7.1.4
 
Posts: 73 | Location: Minneapolis, MN | Registered: August 08, 2007Report 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     Computing a Percentage of Subtotal

Copyright © 1996-2020 Information Builders