If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Crosstab qry not adding up
I've built a crosstab qry for a tenant sales database based on a select qry,
the original select query works (adds up correctly) ive checked by sorting and adding totals to columns, but the crosstab is tripling the amounts in each total field both for each month and the totals - i'm thinking its something to do with the fact there are three different income types (rent, cleaning, other) because the rows where the tenant has only one income type are correct this is the code TRANSFORM Sum(SalesToTenant.[Amount]) AS SumOfAmount SELECT SalesToTenant.[Company], SalesToTenant.[IncomeType], Sum(SalesToTenant.[Amount]) AS [Total Of Amount] FROM SalesToTenant GROUP BY SalesToTenant.[Company], SalesToTenant.[IncomeType] PIVOT Format([Date],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug"," Sep","Oct","Nov","Dec"); -- deb |
#2
|
|||
|
|||
Crosstab qry not adding up
You did not post the the original select query SQL. That might be the
problem when it feeds the crosstab. -- Build a little, test a little. "deb" wrote: I've built a crosstab qry for a tenant sales database based on a select qry, the original select query works (adds up correctly) ive checked by sorting and adding totals to columns, but the crosstab is tripling the amounts in each total field both for each month and the totals - i'm thinking its something to do with the fact there are three different income types (rent, cleaning, other) because the rows where the tenant has only one income type are correct this is the code TRANSFORM Sum(SalesToTenant.[Amount]) AS SumOfAmount SELECT SalesToTenant.[Company], SalesToTenant.[IncomeType], Sum(SalesToTenant.[Amount]) AS [Total Of Amount] FROM SalesToTenant GROUP BY SalesToTenant.[Company], SalesToTenant.[IncomeType] PIVOT Format([Date],"mmm") In ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug"," Sep","Oct","Nov","Dec"); -- deb |
Thread Tools | |
Display Modes | |
|
|