R
Roger
I am trying to get via crosstab query (any query will do)
the sum of sales per month for each product, below is the
sql for the current query.
I can not find a criteria that will give me the last 12
months march 2004 - april 2003. I want the last 12 months
to be selected on a rolling basis eg: next month i want
it to show April 2004 - May 2003, the month after may to
june 2003 etc....
I think I am going wrong with creating the date field as
I have done, but I need these for column headings in the
cross tab.
Please help, thanks for any assistance:
Sql as follows
TRANSFORM Sum(InvoiceDet.Quantity) AS SumOfQuantity
SELECT InvoiceHdr.Customer_Name, InvoiceDet.Section,
InvoiceDet.PartNumber, InvoiceDet.Colour
FROM InvoiceHdr INNER JOIN (InvoiceDet INNER JOIN Stock
ON (InvoiceDet.Colour = Stock.Colour) AND
(InvoiceDet.PartNumber = Stock.PartNumber) AND
(InvoiceDet.Section = Stock.Section)) ON
InvoiceHdr.Invoice_Number = InvoiceDet.Invoice_Number
WHERE (((Month([InvoiceHdr]![Date]))<=(Month(Date()-12)))
AND ((Year([InvoiceHdr]![Date]))>=Year(Date())-1))
GROUP BY InvoiceHdr.Customer_Name, InvoiceDet.Section,
InvoiceDet.PartNumber, InvoiceDet.Colour
PIVOT (MonthName(Month([InvoiceHdr]![Date]),3) & " " &
Year([InvoiceHdr]![Date]));
- - - - - - - - - - - - - - - -
Thanks again
the sum of sales per month for each product, below is the
sql for the current query.
I can not find a criteria that will give me the last 12
months march 2004 - april 2003. I want the last 12 months
to be selected on a rolling basis eg: next month i want
it to show April 2004 - May 2003, the month after may to
june 2003 etc....
I think I am going wrong with creating the date field as
I have done, but I need these for column headings in the
cross tab.
Please help, thanks for any assistance:
Sql as follows
TRANSFORM Sum(InvoiceDet.Quantity) AS SumOfQuantity
SELECT InvoiceHdr.Customer_Name, InvoiceDet.Section,
InvoiceDet.PartNumber, InvoiceDet.Colour
FROM InvoiceHdr INNER JOIN (InvoiceDet INNER JOIN Stock
ON (InvoiceDet.Colour = Stock.Colour) AND
(InvoiceDet.PartNumber = Stock.PartNumber) AND
(InvoiceDet.Section = Stock.Section)) ON
InvoiceHdr.Invoice_Number = InvoiceDet.Invoice_Number
WHERE (((Month([InvoiceHdr]![Date]))<=(Month(Date()-12)))
AND ((Year([InvoiceHdr]![Date]))>=Year(Date())-1))
GROUP BY InvoiceHdr.Customer_Name, InvoiceDet.Section,
InvoiceDet.PartNumber, InvoiceDet.Colour
PIVOT (MonthName(Month([InvoiceHdr]![Date]),3) & " " &
Year([InvoiceHdr]![Date]));
- - - - - - - - - - - - - - - -
Thanks again