0

My team is wanting a pivot table showing sales per month for the past 24 months for each item we carry. I am a little stuck getting the past 24 months from our sales table. My issue is I can get close, but for January 2016 it is only showing mid month.

where invoicedate >= DATEADD(MONTH, -24, GETDATE())

I have been using the following query but am a little stuck in what I need to change to get from 2016-01-01 without hard-coding that as a date.

MattC
  • 119
  • 2
  • 13
  • 1
    I think my question was somewhat different but was able to figure out how to use what you linked. What I needed ended up being: DATEADD(MONTH, -24, DATEADD(month, DATEDIFF(month, 0, getdate()), 0)) – MattC Jan 19 '18 at 21:06
  • That was the intent! Glad you got it sorted. – Jacob H Jan 19 '18 at 21:07

0 Answers0