I am trying to generate a crosstab report for monthly sales grouped by product category that looks like this:
The numbers come from tables like this:
I have a working crosstab report that is based only on new orders (the first table), but I can't figure out how to get the ChangeValue in the second table to be included based on the month of the ChangeDate and the ProductCode of the associated original order.
Code:
ReportingGroup Jan Feb Mar Apr May Jun ...
Group1 2000 4000
Group2 3050 3000
Group3
Group4 4000 5000 5000 5000 5000 5000
Group5
Code:
tblOrders
JobNumber OrderDate OrderValue ProductCode
20027159 12/28/2002 2000 A
20037001 01/03/2003 3000 B
20037002 01/06/2003 4000 C
20037003 01/07/2003 3500 A
tblChangeOrders
JobNumber ChangeID ChangeDate ChangeValue
20027159 1 01/10/2003 -440
20037003 1 02/05/2003 1000
20037003 2 2/12/2003 -50
tblProductCodes
ProductCode ReportingGroup
A Group1
B Group1
C Group2
D Group2