Focal Point
[Closed] Problem getting the average of a field using "across field"

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

June 01, 2012, 01:27 PM
info4pals
[Closed] Problem getting the average of a field using "across field"
Hi....I'm using the below code :
DEFAULT &YEAR =2012;
TABLE FILE DEPT
SUM AVE.QNTY NOPRINT
BY DIVISION
BY MSC

SUM QNTY
COMPUTE YTD_AVG/D20 = C1;
BY DIVISION
BY MSC
ACROSS WEEKS
WHERE YEAR EQ &YEAR;
END
-RUN
-EXIT

Here,for example I might be having say 8 weeks for the year 2012 namely :1,3,4,5,6,7,8,9.Now iam not getting the correct YTD_AVG for all the divisions.Iam getting the correct average value for 1 or 2 divisions.
This would be the formulae which applies for calculating the average :YTD_AVG=(SUM.QNTY/CNT.DST.WEEKS)-->(1+3+4+5+6+7+8+9)/8
Could anyone please help me with this problem?Thanks a lot in advance!

This message has been edited. Last edited by: Kathleen Butler,


webfocus 769,windows 7,html
June 07, 2012, 01:51 PM
Kerry
Hi info4pals,

From our technicals: please try BY YEAR after BY MSC in both verb sets. If this does not work, please open a case with Customer Support Services. You may call at 1-800-736-6130, or access online at InfoResponse.

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
June 07, 2012, 03:04 PM
Kerry
Hi info4pals,

From our technicals: please try this code.
DEFINE FILE EMPDATA
YEAR/YY=HIREDATE;
DT_HIREDATE/HYYMDS=HDTTM(HIREDATE, 8, 'HYYMDS');

YRWK/I2=HPART(DT_HIREDATE, 'WEEK', 'I2');
END
TABLE FILE EMPDATA
-*PRINT HIREDATE DT_HIREDATE YRWK
-*BY YEAR

SUM AVE.SALARY
BY DIV
BY DEPT
BY YEAR

SUM SALARY

BY DIV
BY DEPT
BY YEAR
ACROSS YRWK
COMPUTE YTD_AVG/D20 = C1;
WHERE YEAR EQ 1989;
END


Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.