supportsvc
Technical User
I can't seem to get YTD for beginning of the year to last month and last year to last month
2017 would include Jan - Mar = see highlighted, that seems to work
2018 would include Jan - Mar = this section does not
When the current year is removed, I get what I need for 2017, but when adding the current year criteria, I get all of last year only.
2017 would include Jan - Mar = see highlighted, that seems to work
2018 would include Jan - Mar = this section does not
Code:
WHERE [highlight #FCE94F](dbo.SO_SalesOrderHistoryHeader.OrderDate <= DATEADD(YEAR, - 1, DATEADD(mm, - 1, GETDATE())))[/highlight] OR
(dbo.SO_SalesOrderHistoryHeader.OrderDate <= DATEADD(mm, - 1, GETDATE()))
HAVING [highlight #FCE94F](YEAR(dbo.SO_SalesOrderHistoryHeader.OrderDate) = YEAR(GETDATE()) - 1)[/highlight] AND
(YEAR(dbo.SO_SalesOrderHistoryHeader.OrderDate) = YEAR(GETDATE()))
When the current year is removed, I get what I need for 2017, but when adding the current year criteria, I get all of last year only.