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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Net working days between two dates

Hello guys,

 

I am a little bit struggling with my dax formula about the net working days between two dates. I have an inbound and an outbound date (Table: CCCE WSPs) and want to calculate the net working days between these dates.

I got a date table as well with a simple relationship to the table with the inbound and outbound dates and a column with the working days (1 for working day, 0 for weekend).

 

I tried some measures but nothing worked really well. 

 

Days Inbound to Outbound = CALCULATE(COUNT('Date'[Working Days]);DATESBETWEEN('Date'[Date].[Date];'CCCE WSPs'[Creation date (inbound).1];'CCCE WSPs'[Shipping date (outbound).1]))

 

Here should be calculated the net working days from the left to the right dateHere should be calculated the net working days from the left to the right dateThis is the date tableThis is the date table

 

Maybe it is possible with an IF-Fuction like:

 

IF(RELATED('Date'[Working Days]<=5);calculate(COUNT('Date'[Working Days]);DATESBETWEEN('Date'[Date].[Date];'CCCE WSPs'[Creation date (inbound).1];'CCCE WSPs'[Shipping date (outbound).1])))

 

Best regards,

Christopher

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks @v-sihou-msft,

 

I solved the problem one hour ago with this formula:

 

Days Inbound to Outbound = COUNTROWS(FILTER(ADDCOLUMNS(CALENDAR('CCCE WSPs'[Creation date (inbound).1].[Date];'CCCE WSPs'[Shipping date (outbound).1]);"Day of Week";WEEKDAY([Date];2));[Day of Week]<>6 && [Day of Week]<>7)).

 

Works good as well Smiley Happy

 

Regards,

View solution in original post

2 REPLIES 2
v-sihou-msft
Microsoft Employee
Microsoft Employee

@Anonymous

 

In this scenario, you already have the "IsWorkingDay" column in your Date table. You just need to use SUM() function to get the working days. You should create calculated column instead of a measure: 

 

Working Days Inbound to Outbound =
CALCULATE (
    SUM ( 'Date'[Working Days] ),
    DATESBETWEEN (
        'Date'[Date],
        'CCCE WSPs'[Creation date (inbound).1],
        'CCCE WSPs'[Shipping date (outbound).1]
    )
)

Please refer to this article: 

NETWORKDAYS() Equivalent in PowerPivot?

 

Regards,

 

 

Anonymous
Not applicable

Thanks @v-sihou-msft,

 

I solved the problem one hour ago with this formula:

 

Days Inbound to Outbound = COUNTROWS(FILTER(ADDCOLUMNS(CALENDAR('CCCE WSPs'[Creation date (inbound).1].[Date];'CCCE WSPs'[Shipping date (outbound).1]);"Day of Week";WEEKDAY([Date];2));[Day of Week]<>6 && [Day of Week]<>7)).

 

Works good as well Smiley Happy

 

Regards,

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.