Focal Point
[CLOSED] SUM of AVG count Issue.

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

February 06, 2014, 08:36 AM
Senthil
[CLOSED] SUM of AVG count Issue.
There is a defined column for Average of counts ("counts" is defined column having rownumber).
As per the requirement, need to do SUM(AVE.COUNT) based on BY field.

When I do SUM(Count), its coming fine but not able to do sum on AVE.COUNT, is there any method to acheive sum up the AVG of Counts.

Could you please let me know , how to handle this ??

Thanks,
Senthil

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


8.0.04 Version
Unix
HTML,Excel
February 06, 2014, 11:06 AM
Dave
Senthill,

I think I know what you mean, but could post an example of what you're trying?

( You could always add an extra Row-counter and devide the sum by the number of rows... )

e.g.
DEFINE FILE CAR
	ROWCOUNTER/I11 = 1;
END

TABLE FILE CAR
	SUM	SALES	NOPRINT
		ROWCOUNTER	NOPRINT
		COMPUTE AVG_SALES/D12.2 = SALES / ROWCOUNTER; 
	BY  COUNTRY
END



_____________________
WF: 8.0.0.9 > going 8.2.0.5
February 07, 2014, 12:49 AM
Senthil
Dave ,
Here is the sample code,
DEFINE FILE CAR
Count/I5=1;
MDEL_LEN/A50=CAR.CARREC.MODEL ||EDIT(CAR.SPECS.LENGTH);
END
TABLE FILE CAR
SUM
CAR.BODY.SALES
AVE.Count AS 'AVE,Count'
BY LOWEST CAR.ORIGIN.COUNTRY
BY LOWEST CAR.COMP.CAR
BY CAR.SPECS.MDEL_LEN NOPRINT
ACROSS LOWEST CAR.BODY.SEATS
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE ROW-TOTAL AS 'TOTAL'
ON TABLE COLUMN-TOTAL AS 'TOTAL'
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
TYPE=DATA,
COLUMN=N4,
BACKCOLOR='WHITE',
$
TYPE=ACROSSVALUE,
ACROSS=1,
BACKCOLOR='WHITE',
$
TYPE=REPORT,
COLUMN=N3,
SQUEEZE=1.416667,
$
ENDSTYLE
END

Output Is :
SEATS
2 4 5 TOTAL
"
COUNTRY" "
CAR" "
SALES" "AVE
Count" "
SALES" "AVE
Count" "
SALES" "AVE
Count" "
SALES" "AVE
Count"
ENGLAND JAGUAR 0 1 0 1
12000 1 12000 1
JENSEN 0 1 0 1
TRIUMPH 0 1 0 1
FRANCE PEUGEOT 0 1 0 1
ITALY ALFA ROMEO 4800 1 4800 1
12400 1 12400 1
13000 1 13000 1
MASERATI 0 1 0 1
JAPAN DATSUN 43000 1 43000 1
TOYOTA 35030 1 35030 1
W GERMANY AUDI 7800 1 7800 1
BMW 8900 1 8900 1
8950 1 8950 1
18940 1 18940 1
14000 1 14000 1
15600 1 15600 1
14000 1 14000 1
TOTAL 25400 5 91730 5 91290 8 208420 18


But Expected output is :

SEATS
2 4 5 TOTAL
"
COUNTRY" "
CAR" "
SALES" "AVE
Count" "
SALES" "AVE
Count" "
SALES" "AVE
Count" "
SALES" "AVE
Count"
ENGLAND JAGUAR 0 1 1 12000 1 12000 1
JENSEN 0 1 0 1
TRIUMPH 0 1 0 1
FRANCE PEUGEOT 0 1 0 1
ITALY ALFA ROMEO 25400 3 4800 1 30200 3
MASERATI 0 1 0 1
JAPAN DATSUN 43000 1 43000 1
TOYOTA 35030 1 35030 1
W GERMANY AUDI 7800 1 7800 1
BMW 8900 1 71490 5 80390 6
TOTAL 25400 5 91730 5 91290 8 208420 18


Can help me to archeive this.


Thanks,
Senthil


8.0.04 Version
Unix
HTML,Excel
February 07, 2014, 01:55 AM
Dave
Like this?

DEFINE FILE CAR
Count/I5=1;
MDEL_LEN/A50=CAR.CARREC.MODEL ||EDIT(CAR.SPECS.LENGTH);
END

TABLE FILE CAR
SUM 
CAR.BODY.SALES
Count
-*AVE.Count AS 'AVE,Count'
BY LOWEST CAR.ORIGIN.COUNTRY
BY LOWEST CAR.COMP.CAR
-*BY CAR.SPECS.MDEL_LEN  
ACROSS LOWEST CAR.BODY.SEATS
ON TABLE SET PAGE-NUM NOLEAD 
ON TABLE ROW-TOTAL AS 'TOTAL'
ON TABLE COLUMN-TOTAL AS 'TOTAL'
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
TYPE=DATA,
COLUMN=N4,
BACKCOLOR='WHITE',
$
TYPE=ACROSSVALUE,
ACROSS=1,
BACKCOLOR='WHITE',
$
TYPE=REPORT,
COLUMN=N3,
SQUEEZE=1.416667,
$
ENDSTYLE
END



_____________________
WF: 8.0.0.9 > going 8.2.0.5
February 07, 2014, 08:25 AM
Senthil
quote:
BY CAR.SPECS.MDEL_LEN

Thanks for your reply ,

I need to include the commented BY field as well
to retrieve the required results

CAR.SPECS.MDEL_LEN

PLease suggest how to acheive to get it with the BY field ??

Thanks,
Senthil.


8.0.04 Version
Unix
HTML,Excel
February 07, 2014, 10:22 AM
Dave
Senthill,

That will change the outcome of the SUM for each row. Even with NOPRINT.

If you need the SUM values on each row independent of the commented By-Field you might want to add it later ( with MATCH for example ) or use sort-groups.

G'luck.

( I'm still trying to understand want the desired functionality is ).


_____________________
WF: 8.0.0.9 > going 8.2.0.5