J
John
I have been working on this all day and can't seem to make it work. I have a
crosstab query that shows a cost code and description and monthly period
cost. I added an average field at the end of all the values that looks like
this in the query grid:
AverageCost: Avg(IIf([ACst]-[PP_ACst]=0,Null,[ACst]-[PP_ACst]))
This is working great, but now I would also like an average cost based on
the last three months. I think this is a task for a subquery, but I can't
seem to get the syntax correct. In the query grid I put:
3MoSum: (SELECT SUM([tblDupe]![ACst]-[tblDupe]![PP_ACst]) tblMonthly AS
tblDupe WHERE [tblDupe]![act] = [tblMonthly]![act] and [tblDupe]![FnDte] <=
dateadd("m",-3,datevalue([forms]![frmProjectCost]![cmbCurMon]))) / 3
The field 'ACst' is the total actual cost to date, and the field 'PP_ACst'
is the total actual cost to date last month. The difference is the period
cost, for which I need an average.
Any help would be appreciated...
crosstab query that shows a cost code and description and monthly period
cost. I added an average field at the end of all the values that looks like
this in the query grid:
AverageCost: Avg(IIf([ACst]-[PP_ACst]=0,Null,[ACst]-[PP_ACst]))
This is working great, but now I would also like an average cost based on
the last three months. I think this is a task for a subquery, but I can't
seem to get the syntax correct. In the query grid I put:
3MoSum: (SELECT SUM([tblDupe]![ACst]-[tblDupe]![PP_ACst]) tblMonthly AS
tblDupe WHERE [tblDupe]![act] = [tblMonthly]![act] and [tblDupe]![FnDte] <=
dateadd("m",-3,datevalue([forms]![frmProjectCost]![cmbCurMon]))) / 3
The field 'ACst' is the total actual cost to date, and the field 'PP_ACst'
is the total actual cost to date last month. The difference is the period
cost, for which I need an average.
Any help would be appreciated...