Using the following tblFinancials table:
Category Year Amount
------------ ----- ------
Income 1998 10.00
Income 1999 15.00
Income 2000 22.00
Expenses 1998 8.00
Expenses 1999 9.00
Expenses 2000 10.00
Net Income 1998 2.00
Net Income 1999 6.00
Net Income 2000 12.00
You can achieve your goal by using a Cross-tab query as follows:
TRANSFORM Sum(tblFinancials.Amount) AS SumOfAmount
SELECT tblFinancials.Category
FROM tblFinancials
GROUP BY Switch([Category]="Income",1,[Category]="Expenses",2,True,3), tblFinancials.Category
ORDER BY Switch([Category]="Income",1,[Category]="Expenses",2,True,3), tblFinancials.Year
PIVOT tblFinancials.Year;
Special Note: You'll notice the use of the Switch statement which I have used here to control the row order of the returned results.
Hope this helps.