# How to calculate Business days between two dates in PowerApps?

0 like 0 dislike
1.2k views

edited

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?

2 like 0 dislike
by 29 53 84
selected by

### 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 18 20 27
0 0