You are currently viewing How Power Automate add working days to date? : Correct solution
How Power Automate add working days to date

How Power Automate add working days to date? : Correct solution

In this blog post, we will learn how Power Automate add working days to date, or how Power Automate add business days to date.

Power Automate add working days to date

The DateDiff function allows an app to calculate the difference between two dates , but what if your organization only needs to consider the business days excluding weekends and holidays, this what we will learn here to add business days using power automate. To check how to add business days power Apps please check this article

To add working days to a date this mean to exclude Weekends and Holidays from these days.

Use case

  • Give any approver a deadline of 2 business days “Working days” to make a decision from the time they receive the request in their inbox.
  • Business time is assumed to be Monday to Friday 9:00am to 5:00pm, so weekends and public Holidays are not counted. For example, if Approval is sent to CEO on a Friday, the deadline would be on Tuesday (not Sunday).

Steps :Power Automate add business days to date

  • Remove holidays from the period, here we store the holidays in a SharePoint list with 2 fields holiday name and its start date.
  • Remove Weekends from the period

There is no one formula for holidays, each country has its own list of holidays.

  1. Get the list of holidays that are greater than or equal your date “here is the modified date of the SharePoint list” and less than or equal the date that is 2 days after your date (Modified+2) to check if there are any holidays in this period after adding 2 days, here I used addDays function to add 2 days to the modified date.
1 1 | Power Platform Geeks
get length of holidays
  1. Next we add the number of days that will be holiday to your date and add the 2 business date that we want to add as a dead line. ere use the function length to get the number of holidays that will be found in this period.
1 2 | Power Platform Geeks
Power Automate add business days to date exclude holidays
  1. Next we have to exclude the weekends from the calculation to calculate the Deadline correctly excluding Weekends and holidays.
    1. save your date “Modified” in variable that is StartApprovalDate here.
    2. Use “Do until” to loop until your variable is greater than the Deadline that we calculated before and chick if every day in this period is Weekends or not Note: weekends here are Saturday and Sunday : the dayOfWeek function will return 0 for Sunday 6 for Saturday.
    3. If the day is a Weekend then we will add one day to the variable start date to be the next day and increment the number of weekends “that is variable that initialized with zero before”.
    4. If the day is not a weekend then add day to the variable only to move to the next day.
    5. this will loop through the period till dead line
2 | Power Platform Geeks
exclude weekends in Power Automate
  1. Next we will add the number of weekends that we will found to the deadline that we calculated before. So the new deadline is after adding 2 business days to the date and ignoring weekends and holidays.
1 3 | Power Platform Geeks
Calculate the new deadline after adding 2 business days

This the whole steps that we defined before

Power Automate add working days to date
Power Automate add working days to date

This is how power automate add working days to a date

See Also
Join us
Need Help
  • Have a related question? Please ask it at deBUG.to Community.

Heba Kamal

Microsoft MVP, MCT, Technical Speaker, Blogger, and Microsoft 365 and Power Platform Consultant.