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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
drake
Frequent Visitor

Networkdays

HI Guys new to this so trying to translate my excel skills to DAX !

 

I have two date columns and i want the working days between

iecolum A 1-june-2016   and column B 30-December 2016

current using the DATEDIFF ftn which is a good starting point

 

What im looking for is help with is :

a) how to deal with a a missing date - i want 0 for that row

b)if the date in colum A is greater thab B to rerun a negaive value

 

iwoould like to see something like that below giving results in column C

     A                  B                   C

1/1/16          14/1/16           10 [ Working days]

1/1/16           BLANK              0

14/1/16         1/1/16            -10

 

Hope thats clear - thanks 

 

1 ACCEPTED SOLUTION

@drake

 

In this scenario, you need to have a full calendar date table, then add a column to tag if the date is working day.

 

IsWorkingDay = IF(WEEKDAY('Calendar'[Date],2)>5,0,1)

8.PNG

 

 

Then you can create a calculated column like below:

 

NetWorkingDays =
IF (
    ISBLANK ( DateRange[StartDate] ) || ISBLANK ( DateRange[EndDate] ),
    0,
    IF (
        DateRange[StartDate] <= DateRange[EndDate],
        CALCULATE (
            COUNT ( 'Calendar'[IsWorkingDay] ),
            DATESBETWEEN ( 'Calendar'[Date], DateRange[StartDate], DateRange[EndDate] )
        ),
        - CALCULATE (
            COUNT ( 'Calendar'[IsWorkingDay] ),
            DATESBETWEEN ( 'Calendar'[Date], DateRange[EndDate], DateRange[StartDate] )
        )
    )
)

99.PNG

 

 

Regards,

View solution in original post

4 REPLIES 4
mattbrice
Solution Sage
Solution Sage

Networkdays = IF ( ISBLANK ( table[Date A] ) || ISBLANK ( table[Date B] ), 0, DATEDIFF ( table[Date A], table[Date B], day ) )

thanks - i had this but im not sure if your formula - [which is cleverer than mine !]  will return network days or calander days ?

 

 

APP 2 Posting = if(OR
('Data'[First Fully Approved Date]=0,'Data'[First Sourced Date]=0)
,0,
(DATEDIFF
('Data'[First Fully Approved Date].[Date],'Data'[First Sourced Date].[Date],DAY)
))

@drake

 

In this scenario, you need to have a full calendar date table, then add a column to tag if the date is working day.

 

IsWorkingDay = IF(WEEKDAY('Calendar'[Date],2)>5,0,1)

8.PNG

 

 

Then you can create a calculated column like below:

 

NetWorkingDays =
IF (
    ISBLANK ( DateRange[StartDate] ) || ISBLANK ( DateRange[EndDate] ),
    0,
    IF (
        DateRange[StartDate] <= DateRange[EndDate],
        CALCULATE (
            COUNT ( 'Calendar'[IsWorkingDay] ),
            DATESBETWEEN ( 'Calendar'[Date], DateRange[StartDate], DateRange[EndDate] )
        ),
        - CALCULATE (
            COUNT ( 'Calendar'[IsWorkingDay] ),
            DATESBETWEEN ( 'Calendar'[Date], DateRange[EndDate], DateRange[StartDate] )
        )
    )
)

99.PNG

 

 

Regards,

Hi

 

Thanks a lot  for your formula, but there is a small issue I found that instead of using COUNT I used SUM now it is working fineSmiley Happy

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.