Forum Discussion
VicCC
3 years agoFrequent 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
- Greg_Deckler
Community Champion
VicCC Try NETWORKDAYS function or the old way of doing it: Net Work Days - Microsoft Power BI Community
- VicCCFrequent Visitor
Thank you, NETWORKDAYS works nicely!