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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Count of days within two dates

Hi Gurus,

 

I would like to create a calculated column to get the number of working days between two dates that are in a specific month.

 

 

For example: 

 

Date 1

27-August-2023

 

Date 2 

8-September-2023

 

Working Days within the two days in September = 5 (Sun-Thu work week)

 

Appreciate your help 🙂

1 ACCEPTED SOLUTION
v-xinruzhu-msft
Community Support
Community Support

Hi @Anonymous 

You can refer to the following measure

Column =
VAR a =
    ADDCOLUMNS (
        CALENDAR ( [Column1], [Column2] ),
        "Workday", WEEKDAY ( [Date], 1 ),
        "Month", MONTH ( [Date] ),
        "Year", YEAR ( [Date] )
    )
RETURN
    COUNTROWS (
        FILTER (
            a,
            [Workday] < 6
                && [Year] = YEAR ( [Column2] )
                && [Month] = MONTH ( [Column2] )
        )
    )

Output

vxinruzhumsft_1-1696302934806.png

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xinruzhu-msft
Community Support
Community Support

Hi @Anonymous 

You can refer to the following measure

Column =
VAR a =
    ADDCOLUMNS (
        CALENDAR ( [Column1], [Column2] ),
        "Workday", WEEKDAY ( [Date], 1 ),
        "Month", MONTH ( [Date] ),
        "Year", YEAR ( [Date] )
    )
RETURN
    COUNTROWS (
        FILTER (
            a,
            [Workday] < 6
                && [Year] = YEAR ( [Column2] )
                && [Month] = MONTH ( [Column2] )
        )
    )

Output

vxinruzhumsft_1-1696302934806.png

Best Regards!

Yolo Zhu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ritaf1983
Super User
Super User

Hi @Anonymous 

You can use networkdays function.

https://learn.microsoft.com/en-us/dax/networkdays-dax

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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