average or what?
--
Duane Hookom
MS Access MVP
Hi.
Firstly, thanks for the reply and thanks for the help.
Great to know there are people like you out there prepared to help
people
like me.
I got the query working
however I can't for the life of me work out
how
to add in my next required field "vale"
I'm sure once I get this one in I'll be able to get the others done.
This is what I have so far, I not sure how to address the value field
SELECT [Building Consents].[Project ID],
Sum(Abs(Year([issued])=Year(Date())-1 And
Month([issued])=Month(Date())-1))
AS projectlastyearlastmonth, Sum(Abs(Year([issued])=Year(Date()) And
Month([issued])=Month(Date())-1)) AS projectthisyearlastmonth,
Sum(Abs([value])=Year(Date()) And Month([issued])=Month(Date())-1) AS
valuethisyearlastmonth
FROM [Building Consents]
GROUP BY [Building Consents].[Project ID];
Query2 Project ID projectlastyearlastmonth projectthisyearlastmonth
valuethisyearlastmonth
1 1 0
b 14 10 0
g 2 0 0
j 0 0 0
I 0 0 0
m 0 0 0
a 5 6 0
f 2 1 0
c 28 20 0
d 5 8 0
k 1 0 0
l 3 0 0
h 0 0 0
o 0 0 0
e 0 0 0
n 0 0 0
Thanks
You could use a totals query:
SELECT PROJECT_ID, Sum(Abs(Year(Date_Issued) = Year(Date())-1 AND
Month(Date_Issued) =Month(Date()) ) as LastYearThisMonth.
...other similar fields
FROM tblSampleData
GROUP BY PROJECT_ID;
You will need to add similar expressions to count for this year and
last
year etc.
--
Duane Hookom
MS Access MVP
Hi
Sample data
DATE_ISSUED PROJECT_ID
01/01/2003 A
01/01/2003 A
01/01/2003 B
01/01/2003 C
01/01/2003 C
01/01/2003 D
01/02/2003 A
01/02/2003 B
01/02/2003 C
01/01/2004 A
01/01/2004 B
01/01/2004 B
01/01/2004 A
01/01/2004 C
01/01/2004 D
01/02/2004 A
01/02/2004 A
01/02/2004 A
01/02/2004 B
01/02/2004 B
01/02/2004 C
01/02/2004 D
The desired results is if I ran this report in Feb 04 the reports
would
show
PROJECTS ISSUED REPORT FOR 01/04
PROJECT ISSUED 01/04 ISSUED 01/03 YTD 01/04 to 12/04
A 2 2
2
B 2 1
2
C 1 2
1
D 1 1
1
In March 04 the reports would show
PROJECTS ISSUED REPORT FOR 02/04
PROJECT ISSUED 02/04 ISSUED 02/03 YTD 01/04 to 12/04
A 3 1
5
B 2 1
4
C 1 1
2
D 1 0
2
Hope this helps
Darryl
Could you please take the time to provide a few sample records
with
the
desired final display in your report?
--
Duane Hookom
MS Access MVP
Hi
I have a database that records events A B C D E for each month
of
the
year.
I want to be avle to produce a reprot that shows totals
for A B C D E for a mont in this year, and the same month last
year
and
year to date totals
Up to now it has been manually done in Excel
I get stuck trying to work out how I pull this month and the
same
month
from
last year on the same report
ideas welcome