Link to home
Start Free TrialLog in
Avatar of Michael Purdham
Michael PurdhamFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How to exclude weekends when using Diffdate function

I have a query to measure delivery performance. Using
DATEDIFF ( DAY , SIH.[Order Date], SIL.[Shipment Date] ) AS [Ship Days],
this gives me a value including weekends.
How do I exclude the weekends?
Thanks.
Avatar of Haris Dulic
Haris Dulic
Flag of Austria image

try this
where datepart (dw,  SIL.[Shipment Date]) is not in ('saturday', 'Sunday')

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Haris Dulic
Haris Dulic
Flag of Austria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Michael Purdham

ASKER

Just what I wanted. Thanks.