Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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.
Solved! Go to Solution.
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.
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.
Use EXCEPT to exclude holidays. https://community.powerbi.com/t5/Quick-Measures-Gallery/Net-Work-Days/td-p/367362
Hi @EmilyM2019
please check out the function I've posted here: https://www.thebiccountant.com/2020/02/20/date-networkdays-function-for-power-query-and-power-bi/
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries