Please note javascript is required for full website functionality.

Blog

Power BI Blog: New DAX Function - NETWORKDAYS

28 July 2022

Welcome back to this week’s edition of the Power BI blog series.  This week, we look at a new yet eerily familiar DAX function, NETWORKDAYS.

There’s a new DAX function to add the family: NETWORKDAYS.  This function returns the number of whole working days between two days.  You should note that you may use any way of expressing a date in Power BI to specify the start and end dates, including the dt“YYYY-MM-DD” notation.

Working days exclude weekends, which are customisable using the optional weekends parameter.  By default, this function will use Saturday and Sunday as the weekend days.  Any dates provided in an optional holidays parameter will also be excluded when calculating working days.

For example, the following will return a result of 20 working days:

WorkingDays := NETWORKDAYS(DATE(2022,10,1), dt"2022-10-30")

For reference, 1 October 2022 is a Saturday, and 30 October 2022 is a Sunday.

The following returns 21 working days, because it specifies the weekend to be Friday and Saturday:

WorkingDaysFriSat := NETWORKDAYS(DATE(2022,10,1), dt"2022-10-30", 7)

Finally, the following returns a result of 19 working days, because it specifies two working days in the timespan as holidays:

WorkingDaysFriSatHolidays :=

VAR _holidays = {DATE(2022, 10, 3), DATE(2022, 10, 4)}

RETURN NETWORKDAYS(DATE(2022, 10, 1), dt"2022-10-30", 7, _holidays)


Check back next week for more Power BI tips and tricks!


Newsletter