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] Weighted Averages

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Weighted Averages
 Login/Join
 
Member
posted
I'm drawing a blank here ..

I need to calc weighted averages based on 2 columns

Amount Return
9,500,000 14.4%
4,750,000 15.0%
3,963,600 22.5%
11,115,000 14.9%
------------------------------------------------
29,328,600 15.77%

I'm sure this is pretty basic, but it's been a while since I've had my WF hat on! I can certainly sum the Amount column, but it's the weighting of the Return that has me stymied.

Each Return value is multiplied by it's corresponding Amount. The sum of these products is then divided by the sum of the Amount column.

A DEFINE? A RECAP? A COMPUTE?

TIA...

This message has been edited. Last edited by: Kerry,
 
Posts: 21 | Location: Springfield, MA | Registered: August 17, 2004Report This Post
Virtuoso
posted Hide Post
Yes do some searches on RECAP. Should be what you need.


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Platinum Member
posted Hide Post
How about this...

TABLE FILE CAR
PRINT
DEALER_COST
RETAIL_COST
COMPUTE MARKUP_PCT/D7.2% = (RETAIL_COST - DEALER_COST) / DEALER_COST * 100;

ON TABLE RECOMPUTE AND SUB-TOTAL
END

Sean


------------------------------------------------------------------------
PROD: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
TEST: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
 
Posts: 210 | Location: Ottawa | Registered: November 03, 2005Report This Post
Member
posted Hide Post
Perhaps we're getting close.

What I need to show as the final result is something like this:

Amount (A) Return (B)
------------ ----------
9,500,000 14.4%
4,750,000 15.0%
3,963,600 22.5%
11,115,000 14.9%
----------------------------
29,328,600 (C) 15.77% (D)

(C) is the sum of (A)
(D) is the sum total of each product (A)*(B), which is then divided by (C) to obtain the correct weighted average return. We can't calculate this until the total amount is known. It is similar to how one would calculate this in Excel, using the =SUMPRODUCT() function.

I'll need to brush up on knowing which WF keywords operate on data as it is retrieved vs when all is retrieved.

Thanks, all. Keep the good advice coming!
 
Posts: 21 | Location: Springfield, MA | Registered: August 17, 2004Report This Post
Platinum Member
posted Hide Post
I'm not sure how this technique would not solve your problem. You need a formula that is COMPUTEd in the TABLE FILE section, which identifies how your Return is derived.

Then the ON TABLE RECOMPUTE AND SUB-TOTAL will total all of your Amounts, and recalculate a weighted (total) Return based on the COMPUTE formula.

Let me know if I am missing something here.

Sean


------------------------------------------------------------------------
PROD: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
TEST: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
 
Posts: 210 | Location: Ottawa | Registered: November 03, 2005Report This Post
Expert
posted Hide Post
i agree with smiths, if B results from a COMPUTE statement in your fex, then ON TABLE SUMMARIZE
or ON fieldname RECOMPUTE
will recrank the proper result.
How is your B determined? Is B static or is it COMPUTEd in your fex?
You would want to COMPUTE your field, and very specifically not DEFINE it; A static, or DEFINEd field won't recompute easily

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




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
Gold member
posted Hide Post
Hi Bill,

You need a defined field that multiplies A * B, then in your table request, sum the field, and then compute a new field that divides the defined field by A. I have an example if you want to see it.

Jen


Release 5.2.4
Upgrading to 7.6
 
Posts: 68 | Location: Springfield MA | Registered: May 07, 2003Report This Post
Member
posted Hide Post
Actually I think your missing a step in the methodology to calculate your weighted average return. The example should be more like the following.

Amount (A)...........Return (B)................... Weight(E) .................. Contribution (F)
----------------------------------------------------------------------------------------------- 9,500,000................14.4%............9,500,000/29,328,600...............0.046644
4,750,000................15.0%............4,750,000/29,328,600...............0.024294
3,963,600................22.5%............3,963,600/29,328,600...............0.030408
11,115,000...............14.9%............11,115,000/29,328,600..............0.056468
--------------------------------------------------------------------------------------------
29,328,600 (C)...............................................................15.77% (D)


D would be the sum of column F, which is E * B. The computed field needs to be the Amount row value divided by the total of column A.

Hope that helps. Sorry about the dots.

This message has been edited. Last edited by: MTracker,
 
Posts: 21 | Registered: November 15, 2004Report This Post
Silver Member
posted Hide Post
I have the the same issue, but the result needs to be displayed as

Amount(A).... Return(B)
------------------------
9,500,000 14.4%
4,750,000 15.0%
3,963,600 22.5%
11,115,000 14.9%
------------------------
29,328,500(C) 15.77%(D)

without displaying the Weight(E) and Contribution(F) used for calculations..display (D) in place of total of Return(B) in the same line..

I tried use Subtotal/Recompute nothing seemed to work.. Tried using FML but that decreased the performance drastically..

I there any other way the output can be displayed as above...

Thanks in advance..


Release: Webfocus 7.6.11
OS/Platform: Windows
Output: HTML, EXL2K
 
Posts: 32 | Registered: October 29, 2010Report 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] Weighted Averages

Copyright © 1996-2020 Information Builders