cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Shankar Frequent Visitor
Frequent Visitor

equivalent function of Networkdays in DAX

Hi Team - I need to calculate the total number of business days between two dates. Attached the file and the results. Please help.Networkdays or Business Days.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Re: equivalent function of Networkdays in DAX

Hi @Shankar,

 

You can try to use below calculate column formula to calculate the total normal workday.(except saturday sunday)

Total WorkDays =
COUNTROWS (
    FILTER (
        ADDCOLUMNS ( CALENDAR ( [Start], [End] ), "Day of Week", WEEKDAY ( [Date], 1 ) ),
        [Day of Week] <> 1
            && [Day of Week] <> 7
    )
)

7.PNG

 

If you need to remove other holidays, you need to create a holiday table and remove them in the formula.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI

View solution in original post

5 REPLIES 5
Community Support
Community Support

Re: equivalent function of Networkdays in DAX

Hi @Shankar,

 

You can try to use below calculate column formula to calculate the total normal workday.(except saturday sunday)

Total WorkDays =
COUNTROWS (
    FILTER (
        ADDCOLUMNS ( CALENDAR ( [Start], [End] ), "Day of Week", WEEKDAY ( [Date], 1 ) ),
        [Day of Week] <> 1
            && [Day of Week] <> 7
    )
)

7.PNG

 

If you need to remove other holidays, you need to create a holiday table and remove them in the formula.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI

View solution in original post

Shankar Frequent Visitor
Frequent Visitor

Re: equivalent function of Networkdays in DAX

Thanks a lot Sir. It works Man Happy

 

Was looking for it badly.

 

 

Thanks,

Shankar A

bengisby Regular Visitor
Regular Visitor

Re: equivalent function of Networkdays in DAX

Hello, could someone show me how to remove holidays as well?

Community Support
Community Support

Re: equivalent function of Networkdays in DAX

Hi @bengisby,

 

If you have other specific holiday need to remove for current date range, you can try to use except function to compare with current visual calendar table. My formula will remove weekend dates from virtual calendar table.

 

Other reference link:

DATEDIFF Working Days

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI
bengisby Regular Visitor
Regular Visitor

Re: equivalent function of Networkdays in DAX

@v-shex-msft, this link is great, but I'm just learning and don't understand how to insert the measure result as a value in the new column... I have a business days value for each row of data, and so I need each row to also remove the holidays.

Helpful resources

Announcements
Coming Soon: T-Shirt Design Contest

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors
Top Kudoed Authors