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,
May 24, 2006, 10:59 AM
Prarie
Yes do some searches on RECAP. Should be what you need.
(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!
May 24, 2006, 03:50 PM
smiths
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
May 25, 2006, 12:08 PM
susannah
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 easilyThis message has been edited. Last edited by: susannah,
In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
May 30, 2006, 01:30 PM
Jen
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
May 31, 2006, 03:52 PM
MTracker
Actually I think your missing a step in the methodology to calculate your weighted average return. The example should be more like the following.