The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
38 | |
23 | |
22 | |
19 | |
15 |