crosstab fa

F

Fred Loh

is it possible to have a row of totals (at the last row) for columns in a
crosstab?

thanks for your reply!
 
R

Rick Brandt

Fred said:
is it possible to have a row of totals (at the last row) for columns
in a crosstab?

thanks for your reply!

Probably can be done with a UNION query, but it would be a lot better to do
so in a report which has such functionality without getting "creative".
 
J

John

Rick said:
Probably can be done with a UNION query, but it would be a lot better to do
so in a report which has such functionality without getting "creative".

Yes it can. First set up the crosstab query as you normally would. Then,
set up a second query based on the crosstab query that simply sums up
each column you want totaled. Then, create a union query with these two
queries. The challenge with this method is that the total row may not
necessarily be at the bottom - it will be sorted alphabetically or
numerically (depending on the field type(s) by which you sort), so it
may appear in the middle somewhere.

Having said all that, I think Rick is right that it would be better to
do this in a report.
 
T

Tom van Stiphout

Rather than the final union query, create a new select query, select
the two previous queries and join them by the PK. Select all columns
from the first, and the sum column from the last.

-Tom.
Microsoft Access MVP
 
J

John

That would certainly display the totals, but it would display them in a
column, not in the last row. It just depends on how he'd prefer to see
them, I guess.
 
Top