April 25, 2016 at 10:35 am
I am looking to count daily data but want to exclude Sat and Sunday .
So when I look for Yesterday's numbers .. it should show me the numbers for Friday on a Monday.
Is there any other way rather than filtering out week 1 and 7 in the query
DATEPART(dw,getdate()) NOT IN( '1' ,'7')
April 25, 2016 at 3:23 pm
For problems such as that (and many more), it can be convenient to have a Calendar table in your database. A simple table with one row per date, showing the date (primary key) and a lot of attributes such as day of week, week number, month, fiscal year, etc etc etc.
Such a table also makes it a lot easier to do tests for business days (excluding not only saturday and sunday but also national holidays and business-specific holidays)
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply