Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
3k views
in Power Apps by 22 23 29
edited by

What is the correct formula to get the date difference between two dates including only the business date without the weekends and the holidays? Iam tried with DatDiff function with no hope
P.S.: the company stores the holidays in a SharePoint list called AnualHolidays!

How to calculate Business days between two dates in PowerApps?


1 Answer

2 like 0 dislike
by 48 54 93
selected by
 
Best answer

Calculate Business days between two dates in PowerApps.

First, the Datdiff function in PowerApps is used to calculate the difference between two dates in a specified unit of time, the unit of time to use for the calculation.
This can be one of the following: "day", "hour", "minute", "second", "month", "quarter", or "year".

But to calculate Business days between two dates excluding Weekends and Holidays, try to use this formula

RoundDown(DateDiff(DatePicker1.SelectedDate, DatePicker2.SelectedDate, TimeUnit.Days) / 7, 0) * 5 +
Mod(5 + Weekday(DatePicker2.SelectedDate) - Weekday(DatePicker1.SelectedDate), 5) -
CountIf(Holidays, StartDate >= DatePicker1.SelectedDate, StartDate <= DatePicker2.SelectedDate)

For more details you can check this post that explains what this formula did!

by 22 23 29
0 0
You made my day, Thanks!
If you don’t ask, the answer is always NO!
...