Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cottrera
Post Prodigy
Post Prodigy

Calculate working days between dates - excluding holidays

Hi I need to calculate the working days (exlcuding weekends and holidays) between the Date logged and Date completed (See jobs completed table below) I have a calendar table (see calendar table below) which contains a column to show weekends and a column to show holidays . 

thank you

 

Jobs completed table 
   
Job referenceDate LoggedDate Completed
541722623/01/201910/06/2019
551290105/03/201910/06/2019
552736412/03/201910/06/2019
553360015/03/201910/06/2019
553491315/03/201910/06/2019
554448321/03/201910/06/2019
556139601/04/201910/06/2019
556726104/04/201910/06/2019
557025605/04/201910/06/2019
557033905/04/201910/06/2019
557371305/04/201910/06/2019
557391105/04/201910/06/2019
557467005/04/201910/06/2019
557654305/04/201910/06/2019
557662605/04/201910/06/2019
557663405/04/201910/06/2019
557677505/04/201910/06/2019
557723605/04/201910/06/2019
557739305/04/201910/06/2019
557880405/04/201910/06/2019
557911705/04/201910/06/2019
558742510/04/201910/06/2019
559084012/04/201910/06/2019
560139018/04/201910/06/2019
560309923/04/201910/06/2019
560322123/04/201910/06/2019

 

Calendar Table  
   
PKDateis_weekendis_holiday
03/04/201700
04/04/201700
05/04/201700
06/04/201700
07/04/201700
08/04/201710
09/04/201710
10/04/201700
11/04/201700
12/04/201700
13/04/201700
14/04/201701
15/04/201710
16/04/201710
17/04/201701
18/04/201700
19/04/201700
20/04/201700
21/04/201700
22/04/201710
23/04/201710
24/04/201700
25/04/201700
26/04/201700
27/04/201700
28/04/201700
1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

@cottrera,

 

Create a calculate column on 'Jobs completed' table using DAX below:

Working Days Number = 
VAR Start_Date = 'Jobs completed'[Date Logged]
VAR End_Date = 'Jobs completed'[Date Completed]
RETURN
CALCULATE(COUNT('Calendar'[PKDate]), FILTER('Calendar', 'Calendar'[PKDate] >= Start_Date && 'Calendar'[PKDate] <= End_Date && 'Calendar'[is_weekend] = 0 && 'Calendar'[is_holiday] = 0))

Capture.PNG 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yuta-msft
Community Support
Community Support

@cottrera,

 

Create a calculate column on 'Jobs completed' table using DAX below:

Working Days Number = 
VAR Start_Date = 'Jobs completed'[Date Logged]
VAR End_Date = 'Jobs completed'[Date Completed]
RETURN
CALCULATE(COUNT('Calendar'[PKDate]), FILTER('Calendar', 'Calendar'[PKDate] >= Start_Date && 'Calendar'[PKDate] <= End_Date && 'Calendar'[is_weekend] = 0 && 'Calendar'[is_holiday] = 0))

Capture.PNG 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Great works fine. Thank you for your quick response

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.