where (au.[DateTime]>= DATEADD(WK,-12,GETDATE()) AND au.[DateTime]< GETDATE())
--gets everyday for the last 12 weeks
How can I modify to get every day for YTD?
where (au.[DateTime]>= DATEADD(WK,-12,GETDATE()) AND au.[DateTime]< GETDATE())
--gets everyday for the last 12 weeks
How can I modify to get every day for YTD?
where au.[DateTime] between DATEADD(yy,DATEDIFF(yy,0,GETDATE()),0)
AND DATEADD(ms,-2,DATEADD(dd, DATEDIFF(dd, 0, getdate()), 0))
This will get you the first day of the current year. A point i am not sure you need the And au.datetime ... since it is YTD it cannot have tomorrow data yet ? I tried -1 MS but for some reason it doesn't work. possible question.