Keran O'Brien
asked on
Add Totals row to crostab query in Access
Hi,
I use the following pivot query in Access database to track the daily work rate of 9 teams:
TRANSFORM Count(Master.Actual) AS Units
SELECT Master.Actual
FROM Teams INNER JOIN Master ON Teams.ID = Master.Teams_ID
WHERE (((Master.Actual) Is Not Null))
GROUP BY Master.Actual
PIVOT Teams.ID
This gives me the dataset in the attached picture..
I have spent way too long trying to add a row to the bottom of that dataset to show the totals..can anyone help / explain? (i am aware there is a totals button in Access 2007 but this is not the solution)
Thanks for reading
I use the following pivot query in Access database to track the daily work rate of 9 teams:
TRANSFORM Count(Master.Actual) AS Units
SELECT Master.Actual
FROM Teams INNER JOIN Master ON Teams.ID = Master.Teams_ID
WHERE (((Master.Actual) Is Not Null))
GROUP BY Master.Actual
PIVOT Teams.ID
This gives me the dataset in the attached picture..
I have spent way too long trying to add a row to the bottom of that dataset to show the totals..can anyone help / explain? (i am aware there is a totals button in Access 2007 but this is not the solution)
Thanks for reading
ASKER
Yes im using 2007 and it is the column totals im looking for but the query is to support a chart, so i need to calculate the totals as part of the query..dont i?
Row totals i can get, what im looking for is to add a single row to the bottom that shows the total for each column..is this posible? i can generate this row on its own usint a different query (that searches the query i have posted) but then i couldn't add it to the table using UNION..
Thanks for the reply..
Row totals i can get, what im looking for is to add a single row to the bottom that shows the total for each column..is this posible? i can generate this row on its own usint a different query (that searches the query i have posted) but then i couldn't add it to the table using UNION..
Thanks for the reply..
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
@ LambertHeenan
Excellent, thank you.
Took me a while to understand it..I thought you couldnt use DISTINCT in access?!
Anyway thanks again.
Excellent, thank you.
Took me a while to understand it..I thought you couldnt use DISTINCT in access?!
Anyway thanks again.
Glad to help. And SQL without DISTINCT would be kind of restricted, don't you think? :-)
For row totals, add the value field again as a row heading.