How it works...

This recipe is fairly straightforward. The first four lines simply ensure that we construct our calendar table in such a way that the earliest date comes first. We then construct a calendar table, __Calendar, that holds our two dates as well as all of the dates between those two dates. We add a column, __WeekDay, which stores the number of the week day (1-7). By using the 2 as our second parameter for the WEEKDAY function, Saturday = 6 and Sunday = 7. We then simply need to filter this table where the __WeekDay column is not 6 or 7 and return the count of the days (rows) remaining.