SELECT DATEADD(DAY, -DATEDIFF(DAY, 0, [Order Date]) % 7, [Order Date]) AS [Week of],
COUNT(*) AS Count
FROM dbo.your_table_name
GROUP BY DATEADD(DAY, -DATEDIFF(DAY, 0, [Order Date]) % 7, [Order Date])
This code is exactly what I need! Thank you so much!
Fast forward 1 year to 2019 using the same day of the month for January. Because January 2019 starts on a Tuesday instead of a Monday, what would you want for the answer?
I'm not concerned what day the month or year starts. I'm more concerned with the start of the week. this query works as needed. but thanks !
I get that... just remember that if you believe that Monday's should be the first day of the week (and, I do), that the first day of the first week in January of 2019 is actually the last day of the year for 2018. Is that going to be acceptable for your reporting purposes?