cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ivo
Frequent Visitor

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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (3,892)