Link to home
Create AccountLog in
Avatar of Keran O'Brien
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..
 User generated image
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
Avatar of infolurk
infolurk

The totals button is the one that should give you column totals. Are you not using 2007, or is it not giving the desired value?

For row totals, add the value field again as a row heading.
Avatar of Keran O'Brien

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..
ASKER CERTIFIED SOLUTION
Avatar of Lambert Heenan
Lambert Heenan
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
@ LambertHeenan
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? :-)