J
John
I am not a guru with access and this problem has me puzzled...
I have a table wiht multiple months of data. The key fields are a cost
code, report date and then several values (Budget, Actual, Forecast, etc.)
All data is in the same table. I would like to create one query that shows a
comparison between two months, say April and March. Some records in March
may be gone from April, in which case the April values should show 0. Here's
a sample what I have:
Date, Code, Budget, Actual
3/30/08, 8000, 34000, 400
3/30/08, 9001, 50000, 500
3/30/08, 18000, 60000, 1200
3/30/08, 21100, 70000, 4600
3/30/08, 34000, 80000, 7600
4/30/08, 8000, 34000, 600
4/30/08, 9001, 50000, 1500
4/30/08, 18000, 60000, 2200
4/30/08, 21100, 150000, 14200
What I would like to see is one query that shows:
Code, BudgetApr, BudgetMar, BudgetDelta, ActualApr, ActualMar, ActualDelta
8000, 34000, 34000, 0, 600, 400,
200
9001, 50000, 50000, 0, 1500, 500,
1000
18000, 60000, 60000, 0, 2200, 1200,
1000
21100, 150000, 70000, 80000, 14200, 7600,
7600
34000, 0, 80000, -80000, 0, 7600,
-7600
I can do this with several queries in a sequense of steps, (one to create a
prior period tabel, one to add the unmatch records as "dummy" activities from
prior period table to current period, and one that joins the tables). This
two complicated for my intended audience. I need a query that they can just
double-click, it asks them for "current" period, and "prior" period and shows
them the data. I have a UNION query that pulls the correct records, but I
can't seem to find a way to pull a query from the UNION query that sets up
"current" and "prior" period columns, given that they change from month to
month.
Any help would be great!!!
I have a table wiht multiple months of data. The key fields are a cost
code, report date and then several values (Budget, Actual, Forecast, etc.)
All data is in the same table. I would like to create one query that shows a
comparison between two months, say April and March. Some records in March
may be gone from April, in which case the April values should show 0. Here's
a sample what I have:
Date, Code, Budget, Actual
3/30/08, 8000, 34000, 400
3/30/08, 9001, 50000, 500
3/30/08, 18000, 60000, 1200
3/30/08, 21100, 70000, 4600
3/30/08, 34000, 80000, 7600
4/30/08, 8000, 34000, 600
4/30/08, 9001, 50000, 1500
4/30/08, 18000, 60000, 2200
4/30/08, 21100, 150000, 14200
What I would like to see is one query that shows:
Code, BudgetApr, BudgetMar, BudgetDelta, ActualApr, ActualMar, ActualDelta
8000, 34000, 34000, 0, 600, 400,
200
9001, 50000, 50000, 0, 1500, 500,
1000
18000, 60000, 60000, 0, 2200, 1200,
1000
21100, 150000, 70000, 80000, 14200, 7600,
7600
34000, 0, 80000, -80000, 0, 7600,
-7600
I can do this with several queries in a sequense of steps, (one to create a
prior period tabel, one to add the unmatch records as "dummy" activities from
prior period table to current period, and one that joins the tables). This
two complicated for my intended audience. I need a query that they can just
double-click, it asks them for "current" period, and "prior" period and shows
them the data. I have a UNION query that pulls the correct records, but I
can't seem to find a way to pull a query from the UNION query that sets up
"current" and "prior" period columns, given that they change from month to
month.
Any help would be great!!!