I'm grouping data with dateadd() by weeks, but I want to group by months instead. I've got this fun little dateadd function.
DATEADD(day, - (1 * DATEPART(dw, Orders.OrderDate - 1)) + 1, CONVERT (date, Orders.OrderDate, 103))
so we're subtracting a week off of the current date - it seemed to me as simple as just changing the datepart to month and subtracting 1 from it,however, this gives me some pretty wacky results how do I modify this to subtract months instead of weeks?
so you basically already tried:
DATEADD(day, - (1 * MONTH(dw, Orders.OrderDate - 1)) + 1, CONVERT (date, Orders.OrderDate, 103))