I am working with an issue where I need to calculate the difference between the 2 dates (datetime format) excluding weekends and non work hours. The work hours to be considered are between 9 am and 6pm , Mon - Fri .
The user wants to have a filter on the Start date.
I have tried a couple of solutions posted on the Power BI community , but they dont seem to be giving me the expected results.
For example in the dataset for Id = 17 , work hours should be close to 2 hours , considering the appliation was created on a Sunday.
I am working with datetime datatypes and need the difference in hours and not days. Also my requirement is more specific - Work hours = Mon - Fri / 9 am - 6 pm. This makes it more complex to calculate.( Maybe easy for a Dax pro , I am still learning DAX and getting my head around it)
I have attached my data extract and the pbix file I am working with.
Please check out this forum topic, it refers to a Power Query function to calculate the time between two dates excluding Non working hours, weekends, holidays in either hours or minutes.
Thank you so much for directing me in the right path. But I somehow couldnt get the function to work. I have followed the exact steps.
Also my requirement has been simplified as below so the function wouldnt work anymore in my case.
For weekdays consider - all hours ie if startdate is 1/01/2020 4pm and enddate is 2/01/2020 5pm then total hours = 25.
If Weekends exclude hours between Friday midnight untill Monday 9 am. ie if startdate is 04/01/2020 4pm and enddate is 06/01/2020 11am then total hours = 2.
Thanks for the above solution which works great. But as I said my requirements are as below:
Consider weekdays as full days.
Exclude the hours between Friday 6pm and Monday 9 am in the datediff cals.
Hi @Sim2312, just a friendly reminder, if your original question has been answered within the forum it is important to mark your thread as ‘solved’. If you have a follow question or concern related to this topic please start a new topic. More details can be found here - Asking Questions On The Enterprise DNA Support Forum.