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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Ilona
Frequent Visitor

DATEDIFF with a filter

Hi,

 

I need to calculate several TATs for my report, but only having number of business days in those TATs.

 

For example, I have a CASE OPEN date and a CASE CLOSE date, I need to calculate the CASE TAT being a Datediff between them, but  returning only business days.

I already have a Date table with all dates marked as "weekday" and "weekend", holidays included.

 

Is there a way to somehow apply a filter to Datediff, or use any other function(s) to have the desired result?

I don't need a total of working days, I need number of days between certain dates to track the service event (opened to part order, part delivery to repair, repair to closure - all in nuber of working days between those dates).

 

please help, thanks!

1 REPLY 1
DataInsights
Super User
Super User

Hi @Ilona , try this measure:

Business Days from Part Delivery to Repair Date = 
VAR vStartDate =
    MAX ( ServiceEvent[Part Delivery Date] )
VAR vEndDate =
    MAX ( ServiceEvent[Repair Date] )
VAR vBusinessDays =
    FILTER (
        'Date',
        'Date'[Date] >= vStartDate
            && 'Date'[Date] <= vEndDate
            && 'Date'[Is Business Day] = "Y"
    )
VAR vResult =
    COUNTROWS ( vBusinessDays )
RETURN
    vResult 

 

This solution requires the column 'Date'[Is Business Day].





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

Proud to be a Super User!




Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors