Okay, so I found a starting point for doing what I want with a crosstab and I'm starting to get a hang of it. This query is written to count the number of programs in each month, broken down into program categories.
Here's the sql:
The program categories are the row headings of the pivot and the months are the column headings. The program category values are: ZM, GT, BD, SC, SP, WE and ZS.
This works great but I have two aspects I can't work out.
1) If there's no programs in a category (say SP), that category doesn't appear in the row headings. How can I force them all to appear? I found ways to force all of the months, but not the categories.
2) Is there a way that I can include an "Annual" column that totals all of the months' values?
Here's the sql:
Code:
TRANSFORM NZ(Count([Event Information].Event_ID),0) AS [Number of Programs]
SELECT [Event Information].Program_Code
FROM [Event Information]
WHERE ( ( (Year([Date_of_Event]))=Year(Date()) )
AND ( ([Event Information].Date_of_Event)<=Date())
)
GROUP BY [Event Information].Program_Code
PIVOT Format([Date_of_Event],"mmmm") In (January,February,March,April,May,June,July,August,September,October,November,December);
The program categories are the row headings of the pivot and the months are the column headings. The program category values are: ZM, GT, BD, SC, SP, WE and ZS.
This works great but I have two aspects I can't work out.
1) If there's no programs in a category (say SP), that category doesn't appear in the row headings. How can I force them all to appear? I found ways to force all of the months, but not the categories.
2) Is there a way that I can include an "Annual" column that totals all of the months' values?