Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How to get Average of 2 columns in Subtotals
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] How to get Average of 2 columns in Subtotals
 Login/Join
 
Gold member
posted
Hello,

I have a subtotal of all columns in the report, but instead of doing a subtotal on one column (AVE REV/LD), I'd like to display average of sums of 2 columns to show accurate average. Right now, the row where it shows subtotals show all totals per region...

Here's my code below:

TABLE FILE RAILDETAIL
PRINT
'RAILDETAIL.RAILDETA.market' AS 'Market'
'RAILDETAIL.RAILDETA.obLoads' AS 'O/B LDS'
'RAILDETAIL.RAILDETA.ibLoads' AS 'I/B LDS'
'RAILDETAIL.RAILDETA.obTrailers' AS 'O/B TRLRS'
'RAILDETAIL.RAILDETA.ibTrailers' AS 'I/B TRLRS'
'RAILDETAIL.RAILDETA.trailerBalance' AS 'TRLR BALANCE'
'RAILDETAIL.RAILDETA.sixWkOB' AS '6 WK O/B'
'RAILDETAIL.RAILDETA.sixWkIB' AS '6 WK I/B'
'RAILDETAIL.RAILDETA.sixWkTrailerBalance' AS '6 WK TRLR BALANCE'
'RAILDETAIL.RAILDETA.totalRev/D20.2C!D' AS 'LH REV'
'RAILDETAIL.RAILDETA.avgRev/D20.2C!D' AS 'AVE REV/LD'
'RAILDETAIL.RAILDETA.avgSchedDays' AS 'AVE SCHED DAYS'
'RAILDETAIL.RAILDETA.expectedINMDLLoads'
AS 'REVENUE AND COSTS,EXPECTED IMDL LDS'
'RAILDETAIL.RAILDETA.OBempties' AS 'O/B MT MOVES'
'RAILDETAIL.RAILDETA.avgRevTrlrDay/D20.2C!D' AS 'AVE REV PER TRLR/DAY'
BY 'RAILDETAIL.RAILDETA.rampRegion' AS 'Rail Ramp Region'

ON RAILDETAIL.RAILDETA.rampRegion SUBTOTAL AS '*TOTAL'
HEADING
"RAMPS/MARKETS<+0>VOLUMES/BALANCE<+0>REVENUE AND COSTS"
FOOTING
""
ON TABLE COLUMN-TOTAL AS 'TOTAL' 'RAILDETAIL.RAILDETA.obLoads' 'RAILDETAIL.RAILDETA.ibLoads' 'RAILDETAIL.RAILDETA.obTrailers' 'RAILDETAIL.RAILDETA.ibTrailers' 'RAILDETAIL.RAILDETA.trailerBalance' 'RAILDETAIL.RAILDETA.sixWkOB' 'RAILDETAIL.RAILDETA.sixWkIB' 'RAILDETAIL.RAILDETA.sixWkTrailerBalance' 'RAILDETAIL.RAILDETA.totalRev' 'RAILDETAIL.RAILDETA.avgSchedDays' 'RAILDETAIL.RAILDETA.expectedINMDLLoads' 'RAILDETAIL.RAILDETA.OBempties'
ON TABLE PCHOLD FORMAT EXL2K
ON TABLE SET STYLE *
UNITS=IN,
SQUEEZE=ON,
ORIENTATION=LANDSCAPE,
TITLETEXT='data',
$
TYPE=DATA,
COLUMN=N11,
FONT='CALIBRI',
SIZE=11,
BACKCOLOR=RGB(245 250 165),
$
TYPE=DATA,
COLUMN=N12,
FONT='CALIBRI',
SIZE=11,
BACKCOLOR=RGB(245 250 165),
$
TYPE=DATA,
COLUMN=N13,
FONT='CALIBRI',
SIZE=11,
BACKCOLOR=RGB(245 250 165),
$
TYPE=DATA,
COLUMN=N14,
FONT='CALIBRI',
SIZE=11,
BACKCOLOR=RGB(245 250 165),
$
TYPE=DATA,
COLUMN=N15,
FONT='CALIBRI',
SIZE=11,
BACKCOLOR=RGB(245 250 165),
$
TYPE=DATA,
COLUMN=N16,
FONT='CALIBRI',
SIZE=11,
BACKCOLOR=RGB(245 250 165),
$
TYPE=DATA,
COLUMN=N4,
FONT='CALIBRI',
SIZE=11,
BACKCOLOR=RGB(236 245 255),
$
TYPE=DATA,
COLUMN=N5,
FONT='CALIBRI',
SIZE=11,
BACKCOLOR=RGB(236 245 255),
$
TYPE=DATA,
COLUMN=N6,
FONT='CALIBRI',
SIZE=11,
BACKCOLOR=RGB(236 245 255),
$
TYPE=DATA,
COLUMN=N7,
FONT='CALIBRI',
SIZE=11,
BACKCOLOR=RGB(236 245 255),
$
TYPE=DATA,
COLUMN=N8,
FONT='CALIBRI',
SIZE=11,
BACKCOLOR=RGB(236 245 255),
$
TYPE=DATA,
COLUMN=N9,
FONT='CALIBRI',
SIZE=11,
BACKCOLOR=RGB(236 245 255),
$
TYPE=DATA,
COLUMN=N10,
FONT='CALIBRI',
SIZE=11,
BACKCOLOR=RGB(236 245 255),
$
TYPE=DATA,
COLUMN=N3,
FONT='CALIBRI',
SIZE=11,
BACKCOLOR=RGB(236 245 255),
$
TYPE=DATA,
COLUMN=N1,
FONT='CALIBRI',
SIZE=11,
BACKCOLOR=RGB(245 250 165),
$
TYPE=DATA,
COLUMN=N2,
FONT='CALIBRI',
SIZE=11,
BACKCOLOR=RGB(245 250 165),
$
TYPE=TITLE,
COLUMN=N11,
BACKCOLOR=RGB(245 250 165),
STYLE=BOLD,
$
TYPE=TITLE,
COLUMN=N12,
BACKCOLOR=RGB(245 250 165),
STYLE=BOLD,
$
TYPE=TITLE,
COLUMN=N13,
BACKCOLOR=RGB(245 250 165),
STYLE=BOLD,
$
TYPE=TITLE,
COLUMN=N14,
BACKCOLOR=RGB(245 250 165),
STYLE=BOLD,
$
TYPE=TITLE,
COLUMN=N15,
BACKCOLOR=RGB(245 250 165),
STYLE=BOLD,
$
TYPE=TITLE,
COLUMN=N16,
BACKCOLOR=RGB(245 250 165),
STYLE=BOLD,
$
TYPE=TITLE,
COLUMN=N4,
BACKCOLOR=RGB(236 245 255),
STYLE=BOLD,
$
TYPE=TITLE,
COLUMN=N5,
BACKCOLOR=RGB(236 245 255),
STYLE=BOLD,
$
TYPE=TITLE,
COLUMN=N6,
BACKCOLOR=RGB(236 245 255),
STYLE=BOLD,
$
TYPE=TITLE,
COLUMN=N7,
BACKCOLOR=RGB(236 245 255),
STYLE=BOLD,
$
TYPE=TITLE,
COLUMN=N8,
BACKCOLOR=RGB(236 245 255),
STYLE=BOLD,
$
TYPE=TITLE,
COLUMN=N9,
BACKCOLOR=RGB(236 245 255),
STYLE=BOLD,
$
TYPE=TITLE,
COLUMN=N10,
BACKCOLOR=RGB(236 245 255),
STYLE=BOLD,
$
TYPE=TITLE,
COLUMN=N3,
BACKCOLOR=RGB(236 245 255),
STYLE=BOLD,
$
TYPE=TITLE,
COLUMN=N1,
BACKCOLOR=RGB(245 250 165),
STYLE=BOLD,
$
TYPE=TITLE,
COLUMN=N2,
BACKCOLOR=RGB(245 250 165),
STYLE=BOLD,
$
TYPE=HEADING,
BACKCOLOR=RGB(245 250 165),
HEADALIGN=BODY,
$
TYPE=HEADING,
LINE=1,
OBJECT=TEXT,
ITEM=1,
FONT='CALIBRI',
SIZE=12,
COLSPAN=2,
STYLE=BOLD,
JUSTIFY=CENTER,
$
TYPE=HEADING,
LINE=1,
OBJECT=TEXT,
ITEM=2,
FONT='CALIBRI',
SIZE=12,
BACKCOLOR=RGB(236 245 255),
COLSPAN=8,
STYLE=BOLD,
JUSTIFY=CENTER,
$
TYPE=HEADING,
LINE=1,
OBJECT=TEXT,
ITEM=3,
FONT='CALIBRI',
SIZE=12,
COLSPAN=6,
STYLE=BOLD,
JUSTIFY=CENTER,
$
TYPE=SUBTOTAL,
BY=1,
FONT='CALIBRI',
SIZE=11,
BACKCOLOR=RGB(245 250 165),
STYLE=BOLD,
$
TYPE=SUBTOTAL,
BY=1,
COLUMN=N4,
BACKCOLOR=RGB(236 245 255),
$
TYPE=SUBTOTAL,
BY=1,
COLUMN=N5,
BACKCOLOR=RGB(236 245 255),
$
TYPE=SUBTOTAL,
BY=1,
COLUMN=N6,
BACKCOLOR=RGB(236 245 255),
$
TYPE=SUBTOTAL,
BY=1,
COLUMN=N7,
BACKCOLOR=RGB(236 245 255),
$
TYPE=SUBTOTAL,
BY=1,
COLUMN=N8,
BACKCOLOR=RGB(236 245 255),
$
TYPE=SUBTOTAL,
BY=1,
COLUMN=N9,
BACKCOLOR=RGB(236 245 255),
$
TYPE=SUBTOTAL,
BY=1,
COLUMN=N10,
BACKCOLOR=RGB(236 245 255),
$
TYPE=SUBTOTAL,
BY=1,
COLUMN=N3,
BACKCOLOR=RGB(236 245 255),
$
TYPE=SUBTOTAL,
COLUMN=N11,
BACKCOLOR=RGB(245 250 165),
$
TYPE=SUBTOTAL,
COLUMN=N12,
BACKCOLOR=RGB(245 250 165),
$
TYPE=SUBTOTAL,
COLUMN=N13,
BACKCOLOR=RGB(245 250 165),
$
TYPE=SUBTOTAL,
COLUMN=N14,
BACKCOLOR=RGB(245 250 165),
$
TYPE=SUBTOTAL,
COLUMN=N15,
BACKCOLOR=RGB(245 250 165),
$
TYPE=SUBTOTAL,
COLUMN=N16,
BACKCOLOR=RGB(245 250 165),
$
TYPE=SUBTOTAL,
COLUMN=N4,
BACKCOLOR=RGB(236 245 255),
$
TYPE=SUBTOTAL,
COLUMN=N5,
BACKCOLOR=RGB(236 245 255),
$
TYPE=SUBTOTAL,
COLUMN=N6,
BACKCOLOR=RGB(236 245 255),
$
TYPE=SUBTOTAL,
COLUMN=N7,
BACKCOLOR=RGB(236 245 255),
$
TYPE=SUBTOTAL,
COLUMN=N8,
BACKCOLOR=RGB(236 245 255),
$
TYPE=SUBTOTAL,
COLUMN=N9,
BACKCOLOR=RGB(236 245 255),
$
TYPE=SUBTOTAL,
COLUMN=N10,
BACKCOLOR=RGB(236 245 255),
$
TYPE=SUBTOTAL,
COLUMN=N3,
BACKCOLOR=RGB(245 250 165),
$
TYPE=SUBTOTAL,
COLUMN=N1,
BACKCOLOR=RGB(245 250 165),
$
TYPE=SUBTOTAL,
COLUMN=N2,
BACKCOLOR=RGB(245 250 165),
$
TYPE=GRANDTOTAL,
FONT='CALIBRI',
SIZE=11,
BACKCOLOR=RGB(245 250 165),
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
COLUMN=N11,
BACKCOLOR=RGB(245 250 165),
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
COLUMN=N12,
BACKCOLOR=RGB(245 250 165),
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
COLUMN=N13,
BACKCOLOR=RGB(245 250 165),
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
COLUMN=N14,
BACKCOLOR=RGB(245 250 165),
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
COLUMN=N15,
BACKCOLOR=RGB(245 250 165),
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
COLUMN=N16,
BACKCOLOR=RGB(245 250 165),
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
COLUMN=N4,
BACKCOLOR=RGB(236 245 255),
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
COLUMN=N5,
BACKCOLOR=RGB(236 245 255),
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
COLUMN=N6,
BACKCOLOR=RGB(236 245 255),
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
COLUMN=N7,
BACKCOLOR=RGB(236 245 255),
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
COLUMN=N8,
BACKCOLOR=RGB(236 245 255),
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
COLUMN=N9,
BACKCOLOR=RGB(236 245 255),
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
COLUMN=N10,
BACKCOLOR=RGB(236 245 255),
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
COLUMN=N3,
BACKCOLOR=RGB(236 245 255),
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
COLUMN=N1,
BACKCOLOR=RGB(245 250 165),
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
COLUMN=N2,
BACKCOLOR=RGB(245 250 165),
STYLE=BOLD,
$
TYPE=REPORT,
COLUMN=N14,
SQUEEZE=1.555556,
$
ENDSTYLE
END

I appreciate any help on this. Thanks!

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


Winnie

Webfocus 7.7.3
 
Posts: 83 | Registered: July 16, 2008Reply With QuoteReport This Post
Master
posted Hide Post
Using FML you can get this done. Else you can do subtotal calculation in a separate hold file, then do a join or match to bring it under one file. Hope this helps.
 
Posts: 542 | Location: Dearborn, MI | Registered: June 03, 2009Reply With QuoteReport This Post
Gold member
posted Hide Post
FML i'm not familiar with, and Match is somthing i try to avoid, but maybe i'm misunderstanding the request, wouldn't bringing the two columns in, creating a new column that's the average of the sum of the two columns, then using a RECOMPUTE instead of subtotal work?
I am a rookie here, but i'm interested to see what works here.


version 8202M
Reporting Server on
Windows Server using DB2 Connect to access data from iseries.
 
Posts: 77 | Registered: December 29, 2009Reply With QuoteReport This Post
Virtuoso
posted Hide Post
If you want the AVE columns recalculated instead of summed in your subtotal, try using SUMMARIZE or RECOMPUTE instead of SUBTOTAL.


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Reply With QuoteReport This Post
Gold member
posted Hide Post
Hello,

Thanks for all the suggestions...the RECOMPUTE works great...Instead of returning the result on the columns from my stored procedure as data, I used an expression in order for it to work...

Winnie


Winnie

Webfocus 7.7.3
 
Posts: 83 | Registered: July 16, 2008Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How to get Average of 2 columns in Subtotals

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.