Focal Point
[SOLVED] How to give average of percentage as subfooter for a report?

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

July 22, 2014, 09:26 AM
Pravin.Singh
[SOLVED] How to give average of percentage as subfooter for a report?
Hi,

I want the report as below:
.0240 M 33.3750 N 7292 Closed 5 4/21/2014 7/14/2014 80,000 85,310 100.00% 85,310 106.64% 0
.0300 M 54.5000 N 7148 Closed 5 4/11/2014 7/7/2014 40,000 42,550 100.00% 42,550 106.38% 0
.0360 M 54.5000 N 4570 Closed 5 1/31/2014 7/7/2014 80,000 84,692 100.00% 84,692 105.87% 0
.0240 M 53.1230 N 7139 Closed 5 4/11/2014 7/14/2014 40,000 46,595 100.00% 46,595 116.49% 0
.0240 M 61.3750 N 7140 Open 5 4/11/2014 7/14/2014 48,500 0 0.00% 0 0.00% 0
.0260 M 60.8800 N 7295 Closed 5 4/21/2014 7/7/2014 40,000 41,722 100.00% 41,722 104.31% 0
.0260 M 60.8800 N 8367 Closed 5 5/9/2014 7/7/2014 40,000 44,338 100.00% 44,338 110.85% 0
.0150 M 41.8100 N 7291 Closed 5 4/21/2014 7/7/2014 40,000 36,530 100.00% 36,530 91.33% 0
Grand Totals 220,577,257 83,613,667 91,993,684

Average % . . 41.36% . 48.04%


Average% is basically the average of % values. I have given it in footer as:
ON TABLE SUBFOOT
"Grand Totals <+0> <+0> <+0> <+0> <+0> <+0> <+0> <+0> <+0> <+0> <+0> <+0> <+0> <+0> <+0> "Average % <+0> <+0> <+0> <+0> <+0> <+0> <+0> <+0> <+0> <+0> <+0> <+0> <+0> <+0> <+0> <+0> <+0>
Grand total is coming correctly but Average% is just taking the last records. It's not averaging.
Can anyone help me on this?

Thanks,
Pravin

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 7703
Windows, All Outputs
pravinsinghwebfocus.blogspot.com
July 22, 2014, 02:30 PM
MartinY
I would suggest to process your detail, grand total and average in three separate table file then merge them all together based on an id for each kind of table, per example : 0det, 1tot, 2avg to have them in the proper order. You can then manage the skip line, header and footer based on these id.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
July 22, 2014, 11:43 PM
jvb
Hi Pravin,
Try using prefix operators in the footer.
Below sample code may help:
DEFINE FILE CAR
PERC/D20.2%=DEALER_COST/RETAIL_COST;
END
TABLE FILE CAR
SUM DEALER_COST
RETAIL_COST
PERC
COMPUTE PERC1/D20.2%=DEALER_COST/RETAIL_COST;
BY COUNTRY
ON TABLE COLUMN-TOTAL
FOOTING
"AVERAGE <+0> <+0> AVE.PERC AVE.PERC1"

ON TABLE SET STYLE *
TYPE =FOOTING,
HEADALIGN=BODY,
$
ENDSTYLE
END

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


WF 8.1.04,Infoassist,Oracle, Excel, PDF,HTML.
July 23, 2014, 03:08 AM
Pravin.Singh
Thanks Martin and Jvb for your inputs. Merging the files, I would try as last attempt.

I tried "AVERAGE <+0> <+0> AVE.PERC AVE.PERC1". but it is displaying last record only as % not actual average.

Thanks,
Pravin

This message has been edited. Last edited by: Pravin.Singh,


WebFOCUS 7703
Windows, All Outputs
pravinsinghwebfocus.blogspot.com
July 23, 2014, 06:21 AM
jvb
Have you tried RECAP command.
DEFINE FILE CAR
PERC/D20.2%=DEALER_COST/RETAIL_COST;
END
TABLE FILE CAR
SUM DEALER_COST
RETAIL_COST
PERC
BY COUNTRY
ON TABLE HOLD AS HLD
END
-RUN
DEFINE FILE HLD
CNT/D1=1;
CNT1/D2=1;
END
TABLE FILE HLD
SUM DEALER_COST
RETAIL_COST
PERC
CNT1 NOPRINT
BY CNT NOPRINT
BY COUNTRY
ON CNT RECAP Average_Percentage/D20.2%=PERC/CNT1;
ON TABLE PCHOLD FORMAT HTML
END


WF 8.1.04,Infoassist,Oracle, Excel, PDF,HTML.
July 23, 2014, 01:06 PM
Doug
Have you considered SUMMARIZE or RECOMPUTE?
July 24, 2014, 08:34 AM
Pravin.Singh
Thanks JVB!!!

It did work... I will try to implement in my report.

Thanks,
Pravin


WebFOCUS 7703
Windows, All Outputs
pravinsinghwebfocus.blogspot.com