Focal Point
[SOLVED] Avg on Total Line

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5571069313

January 15, 2009, 03:51 PM
JOE
[SOLVED] Avg on Total Line
Is it possible to do an average. I searched the forum and was unable to see anything that could help. I tried summarized on column total and it resulted in a sum. Field in question is already aggregated as an average. code:
 TABLE FILE TEAM_HIARCHY
SUM 
     AVE.SCORE AS 'GROUP,AVERAGE'
     CNT.totno AS 'Total No.,Monitored'
     above AS 'No of FSC(s),100% or Above'
     BELOW AS 'No of FSC(s),Below 75%'
     zero AS 'No of Zero,Call(s) Scored'
BY MANAGER
HEADING
""
FOOTING
""
ON TABLE SET PAGE-NUM OFF 
ON TABLE SUMMARIZE VERINT3.SEG01.SCORE VERINT3.SEG01.totno VERINT3.SEG01.above VERINT3.SEG01.BELOW VERINT3.SEG01.zero AS 'TOTAL'
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE * 


Thanks for any assistance possible.

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


WebFocus 7.7.02 WinXP
January 15, 2009, 04:37 PM
FrankDutch
Joe

If you want the overall average of the score a multiverb might do the job.

DEFINE FILE CAR
NEWSAL=SALES;
DUMMY/A1='';
END

TABLE FILE CAR
SUM  AVE.NEWSAL
BY DUMMY
SUM AVE.SALES
BY COUNTRY
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

January 15, 2009, 05:22 PM
j.gross
Is this what you're looking for?

TABLE FILE CAR
PRINT 
 COMPUTE ONE/I9     = SEATS / SEATS ;    NOPRINT
 COMPUTE _SEATS/D9.2= SEATS / ONE ;      AS SEATS
 COMPUTE _COST/D9.2 = DEALER_COST / ONE; AS DEALER_COST
BY CAR 
BY MODEL
ON TABLE SUMMARIZE
END



- Jack Gross
WF through 8.1.05
January 15, 2009, 05:42 PM
Darin Lee
You can also use prefix operators on the Summary Lines.

ON TABLE SUMMARIZE
AVE. SCORE
totno -*(SUM. is the default operator)
above
BELOW
zero

I believe MAX. MIN. and a few others also work. Note that the correct syntax is prefix,dot,space,fieldname. If you don't have the space, it doesn't work.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
January 15, 2009, 10:26 PM
susannah
joe,
please excuse my restating the obvious:
if you COMPUTE the a calculation in your fex,
then as Jack says, the ON TABLE SUMMARIZE
will effectively reCOMPUTE that calculation,
and give you a weighted result.

if you don't COMPUTE a calculation in your fex,
(eg you DEFINE your calculation)
and just want an unweighted result on the total line, then as Darin says, the AVE. prefix will produce that result.

its important to know which way you want, weighted or not.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
January 16, 2009, 09:17 AM
JOE
Thanks for all the advice. Susan led me in the right direction. I ended up building a compute field and then summarized to make the totals work correctly. What I was doing before was just averaging the field with the AVE. prefix which caused the total line to sum. Thanks for the help.


WebFocus 7.7.02 WinXP
February 12, 2009, 04:58 PM
susannah
I learned something today from Noreen
AVE.field is weighted
AVE. field (with a blank after the period) is unweighted.
So...
on your columns, use AVE.field
and on your SUBTOTAL use AVE. field to get an average of the averages...
Her webinar will be posted up on the ibi website in a day or two... the title of it is 'Betcha Didn't Know'... Smiler




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
March 06, 2013, 05:43 PM
texgator
I am running into a similar problem. I am getting the sum for field ASALES instead of the average. I do get desired result when I do 'ON TABLE SUBTOTAL AVE. ASALES' but don't want to go that route and want to get the averages and sums without specifying the prefix operators with every field. Any ideas how I can accomplish that? Thanks.

 
TABLE FILE CAR
SUM 
DEALER_COST 
COMPUTE ASALES = AVE.SALES;
BY COUNTRY
ON TABLE SUMMARIZE 
END

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


WebFOCUS 7.6.10
Windows
all output (Excel, HTML, PDF)
March 07, 2013, 09:54 AM
Davmayf44
TRY THIS

DEFINE FILE CAR
ICNT/I6 = IF SALES NE 0.0 THEN 1 ELSE 0;
END
TABLE FILE CAR
SUM
DEALER_COST
SALES NOPRINT
ICNT NOPRINT
COMPUTE ASALES/I6 =SALES/ICNT;
BY COUNTRY
ON TABLE SUMMARIZE
END


WebFOCUS 7.6
Windows, All Outputs
March 07, 2013, 12:18 PM
texgator
It worked. Thanks!


WebFOCUS 7.6.10
Windows
all output (Excel, HTML, PDF)