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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Shankar
Regular 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
v-shex-msft
Community Support
Community Support

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
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

7 REPLIES 7
bengisby
Helper I
Helper I

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

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
If this post helps, please consider accept as solution to help other members find it more quickly.

@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.

v-shex-msft
Community Support
Community Support

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
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

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

Maybe you can show me? 

Anonymous
Not applicable

I write Same Dax Function but it is showing The start date or end date in Calendar function can not be Blank value.
is ther any function to remove that error.

 

Thanks a lot Sir. It works Man Happy

 

Was looking for it badly.

 

 

Thanks,

Shankar A

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.