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! Request now

Reply
VicCC
Frequent Visitor

Working days between two dates - target date missed

Hello,
 
I am using DAX to create a custom column to calculate the number of working days between two dates (completed date and target date). I have also created a column in my Date table to show TRUE/FALSE to filter out non-working days.
 
Working days between completed and target =
CALCULATE(
    COUNTROWS ( 'DateTable'),
    DATESBETWEEN( 'DateTable'[Date],  FactTable[Completed date], FactTable[Target date]-1),
    'DateTable'[Is working day] = TRUE,
    ALL (FactTable)
)+0
 
The issue I'm having is that this formula only returns a positive value when the completed date is BEFORE the target date (otherwise it returns a 0). I need to also see instances where the target is missed (completed date after target date) and by how many days.
 
(Note sometimes the days are the same, hence the addition of +0 at the end of the syntax, rather than a blank return).
 
How can I adapt the DAX to return the number of working days in both instances, whether the completed date is before or after the target date?
 
Many thanks in advance
 
2 REPLIES 2
VicCC
Frequent Visitor

Thank you, NETWORKDAYS works nicely!

Greg_Deckler
Community Champion
Community Champion

@VicCC Try NETWORKDAYS function or the old way of doing it: Net Work Days - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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
Top Kudoed Authors