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
PowerBInewb
Frequent Visitor

Datediff with filters to exclude weekends

Okay Guys, I have read about 50 posts on this topic and have tried to get a variety of formulas to work, but have been unable to make it work. I am trying to determine the days between open and close of a service ticket excluding weekends. Essentially days to resolution.

 

Objective: Ticket opened - Ticket Closed & filter out weekends (we can worry about Holidays later).

 

I can get this to give me output on days between calls: 

Days to Repair = datediff('_custom_eviews Service Times - Dan'[Date],'_custom_eviews Service Times - Dan'[CloseDate],DAY)

 

I have created a date table and created the following switch: 

is work day = SWITCH(WEEKDAY([Date]),1,0,7,0,1)

 
My Calendar table looks like this:
Dim Table = CALENDAR(DATE(2007,1,1),DATE(2019,12,31)) ||||||| This might be an issue as it is over 10 years|||||
The relationship is linked between date on the calandar and the date on table '_custom_eviews Service Times - Dan'
 
Screenshots are attached. What is the best formula to acheive what I am trying to accomplish. 
 
Thank you so much in advance!!!
 
  Inkeddays to repair_LI.jpg
Dim Table.PNGOverall view.PNG
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @PowerBInewb,

 

Try to use the following calculated column:

 

WorkingDays = 
    Tickets[CloseDate] - Tickets[OpenDate] -
    SUMX(
        FILTER(DimDate;
            DimDate[Date] > Tickets[OpenDate] && 
            DimDate[Date] < Tickets[CloseDate]);
        IF(WEEKDAY(DimDate[Date]) = 1 || WEEKDAY(DimDate[Date]) = 7; 1; 0)
    ) + 1

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

10 REPLIES 10

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.