cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ivo
Helper I
Helper I

Add days to a date without wekeends

Hello! Im trying to do a flow that given a date for example: 14/01/2022 (dd/mm/yyyy) and lets say 6 days, computes me the final date but without counting the weekends, if I do it with addDays it doesnt exclude me weekends, is there anyone that can give me a hand? 

Thanks!

 

1 REPLY 1
MarvinBangert
Super User
Super User

Hey @Ivo 

based on the post from Matthew (How To Add Business Days To A Date In Power Apps (Excludes Weekends) (matthewdevaney.com)) I translated this (as good as possible) to Power Automate, at least from 1-10 from 2022-01-13 it works pretty well:

 

addDays(triggerBody()['date'],add(triggerBody()['number'],mul(div(sub(add(sub(dayOfWeek(triggerBody()['date']),1),triggerBody()['number']),1),5),2)))

 

I used a "manually trigger a flow" with a date and number input. So, you would need to replace "triggerBody()['date']" and "triggerBody()['number']" with your own values.

Please also do some more tests than me, also like with February or leap year.

 

Does this help you? Otherwise please give me some more information.

Best regards
Marvin

If you like this post, give a Thumbs up. If it solved your request, Mark it as a Solution to enable other users to find it.

Blog: Cloudkumpel

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (5,107)