I am working on a report in Microsoft SQL Server Report Builder and I am trying to write an expression that will display only the next 5 business days from today (i.e. a table has 5 columns and it starts from today and proceeds for the next five business days). If the day is a Saturday or Sunday, which using my enumeration value would return a 6 or a 7 using the Weekday function, you would skip ahead to the next business day. Currently I have this expression for the first column after the column with today’s date
IIf(Weekday(DateAdd("d",1,Today()),2)=6,DateAdd("d",3,Today()),
(IIf(Weekday(DateAdd("d",1,Today()),2)=7,DateAdd("d",2,Today()),
DateAdd("d",1,Today()))))
and it doesn’t work. I believe this is because if we have a day like Wednesday, Thursday, or Friday, not enough days are being skipped over for the weekend days.
If we can assume that you are going to start from a business day then there is a simple formula we can use:
where
Xis the number of days that column is from the start date.Unfortunately, it breaks down if the start date is a Saturday or Sunday but if you only need it for business days then you are good to go.