This code is not entirely correct. A year can begin or end with either Saturday or Sunday. For example, 2011 starts on Saturday and ends on Saturday. January 1 and 2, 2011 - Saturday and Sunday, respectively, and December 31, 2011 is also Saturday. The above code does not take this scenario into account. The correct code is:
= (DateDiff(DateInterval.day,Parameters!BeginDate.Value,Parameters!EndDate.Value)+1) - (DateDiff(DateInterval.WeekOfYear,Parameters!BeginDate.Value,Parameters!EndDate.Value)*2) - IIF(Weekday(Parameters!BeginDate.Value,1) = 1,1,0) - IIF(Weekday(Parameters!BeginDate.Value,1) = 7,1,0) - IIF(Weekday(Parameters!EndDate.Value,1) = 1,1,0) - IIF(Weekday(Parameters!EndDate.Value,1) = 7,1,0)
Charles M.
source share