I have a chart that shows total sales for each month. The goal is to show 13 months, including the current month. So for this month it would show Dec 2016 through Dec 2017.
The query my chart is based on is as follows:
Code:
SELECT DISTINCTROW MonthName(Month([DelDate]),True) & " " & Year([deldate]) AS DelMo, Sum(RoundReg([TotalPrice],2)) AS RoundTotals
FROM tblOrderConf INNER JOIN tblOrderDetails ON (tblOrderConf.ConfTableID = tblOrderDetails.ConfTableID) AND (tblOrderConf.ConfTableID = tblOrderDetails.ConfTableID)
WHERE (((Year([DelDate])*12+DatePart("m",[DelDate]))>Year(Date())*12+DatePart("m",Date())-13) AND ((tblOrderDetails.TotalPrice)>0) AND ((tblOrderConf.IsSample)=No))
GROUP BY MonthName(Month([DelDate]),True) & " " & Year([deldate]), Year([deldate]), Month([deldate])
ORDER BY Year([deldate]) DESC , Month([deldate]) DESC;
When I run the query everything shows up as expected, but the chart only displays the months in the current year. I have tried getting it to display more of 2016 by going back to November and October, but it still only shows 2017 months.
Any idea why this is happening?
Thanks in advance for the help.