Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
In this blog, we’ll explore how to use the NETWORKDAYS DAX function in Power BI to calculate the number of working days between two dates, excluding weekends and optionally specified holidays.
The NETWORKDAYS function in Power BI's DAX language helps calculate business days by excluding weekends and specified holidays from the total days between two dates.
Syntax: NETWORKDAYS(<start_date>, <end_date>[, <weekend>, <holidays>])
Step 1: Create a Table Visual
Step 2: Create a Measure for Working Days
Write the DAX measure using the NETWORKDAYS function:
No. of working days =
VAR start_date = SELECTEDVALUE(Orders[OrderDate])
VAR end_date = SELECTEDVALUE(Orders[ShippedDate])
RETURN
NETWORKDAYS(start_date, end_date, 1, HolidayList[HolidayDate])
Note: Ensure the holiday list is loaded as a table in your Power BI model, as the holidays parameter requires a column reference.
Step 3: Add the Measure to the Table Visual
Drag the No. of working days measure into the Table visual.
The output will display the number of business days (excluding weekends and specified holidays) between the order and shipment dates for each record.
Conclusion
The NETWORKDAYS DAX function simplifies calculating business days, making it a valuable tool for time-sensitive metrics such as delivery times, project schedules, or workforce planning.
Best Regards
Anmol Malviya
Data Analyst | Addend Analytics
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.