Forum Discussion

EmilyM2019's avatar
EmilyM2019
Helper II
6 years ago
Solved

Excluding School holidays from date count

Hello all,

 

Looking for some advice if possible.

 

I am building a report that is looking at the length of time a specific HR task is taking. In my data set I have the start data and the end date of the task and I need to count the number of days between the 2 dates. Sounds simple, but I have an issue. I need to be counting in School working days. This will exclude weekends, bank holidays and school holidays.

 

I've got a custom function (from tips that I picked up on here) that excludes the weekends, but for the purpose of holding customers and staff to account for excceding agreed timescales this isn't good enough.

 

If anyone has any advice on how to do this I would be very appreciative.

 

Regards,

Emily.

  • Hi EmilyM2019 ,

     

    I have created a sample for your reference. 

     

    1. We should have a holiday table like that.

     

    2. Then we can create a date table as below and we can count the days based on [isworking day].

    date = 
    ADDCOLUMNS (
        CALENDAR ( DATE ( 2020, 01, 01 ), DATE ( 2020, 12, 31 ) ),
        "isworking day", IF ( WEEKDAY ( [Date], 2 ) > 5 || [Date] IN VALUES ( Holiday[date] ), 0, 1 )
    )
    

     

    For more details, please check the pbix as attached.

     

3 Replies