cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Blondyvl
Helper I
Helper I

Week days count to show me only working days from a start date and end date collumn.

I'm trying to find how to create a weekday count for dates in a start date and end date column. I have used Dattedif for the total days between the dates, however I only want the working days, Monday to Friday.  Please can you help me.  Many thanks.

1 ACCEPTED SOLUTION
Eyelyn9
Community Support
Community Support

Hi @Blondyvl ,

 

I have created dummy data for test:

Eyelyn9_3-1656474364847.png

 

In this case, we need to firstly create a new Calendar table:

Calendar = CALENDAR(MIN('Table'[Start Date]),MAX('Table'[End Date])) 

Eyelyn9_1-1656474224785.png

Then create a measure to calculate the count of working days:

Working Days =
CALCULATE (
    COUNTROWS ( 'Calendar' ),
    FILTER (
        'Calendar',
        [Date] >= MAX ( 'Table'[Start Date] )
            && [Date] <= MAX ( 'Table'[End Date] )
            && WEEKDAY ( [Date], 2 ) IN { 1, 2, 3, 4, 5 }
    )
)

Output:

Eyelyn9_4-1656474373185.png

 

Best Regards,
Eyelyn Qin
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
Eyelyn9
Community Support
Community Support

Hi @Blondyvl ,

 

I have created dummy data for test:

Eyelyn9_3-1656474364847.png

 

In this case, we need to firstly create a new Calendar table:

Calendar = CALENDAR(MIN('Table'[Start Date]),MAX('Table'[End Date])) 

Eyelyn9_1-1656474224785.png

Then create a measure to calculate the count of working days:

Working Days =
CALCULATE (
    COUNTROWS ( 'Calendar' ),
    FILTER (
        'Calendar',
        [Date] >= MAX ( 'Table'[Start Date] )
            && [Date] <= MAX ( 'Table'[End Date] )
            && WEEKDAY ( [Date], 2 ) IN { 1, 2, 3, 4, 5 }
    )
)

Output:

Eyelyn9_4-1656474373185.png

 

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

tomfox
Community Champion
Community Champion

Hi @Blondyvl ,

 

Here a similar thread. You can find various other links in there that I am sure will be helping you!

Working days between two dates - simply! - Microsoft Power BI Community

 

And here a video with a function in Power Query:

PowerBI: Calculate business/working days between two dates in a new column - YouTube

 

Let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

Helpful resources

Announcements
August 2022 update 768x460.jpg

Check it Out!

Click here to learn more about the August 2022 updates!

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors