• Jeff Moden - Thursday, February 1, 2018 4:53 PM

    meichmann - Thursday, February 1, 2018 9:14 AM

    ScottPletcher - Thursday, February 1, 2018 7:58 AM


    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 !