I have the following in my select statement:
CASE WHEN DATEADD(DAY, - 5, GETDATE()) > [Date] THEN '6+' ELSE NULL END AS Test
This works fine, but it also includes weekends. How would I go about not counting weekends in the part that is calculating if todays date - 5 is > date? I want to use only 5 working days, not weekends.
This will exclude Saturday and Sunday from your
CASE WHEN ( (DATEADD(DAY, - 5, GETDATE()) > [Date]) AND (DATEPART(WEEKDAY, DATEADD(DAY, - 5, GETDATE())) NOT IN (7,1)) ) THEN '6+' END AS Test