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

Calculating Business days using flows

Am facing challenge in MS Flows .I need some help in calculating working days in backwards.  Assume given date as 7/1/2019( 1st July 2019) and days I want reduce is by 3. It should give back as 6/26/2019 result. It should ignore weekend days.

 

8 REPLIES 8
v-bacao-msft
Community Support
Community Support

Hi @PraveenH ,

 

Please Try the following method to get the expected Date.

  • Use Compose-Reduce to specify the date you want to subtract.
  • Configure the variable Date to specify the initial date and record Date. Number variable is used to control the loop.
  • Use dayOfWeek() function to exclude Saturday and Sunday, and if not, increment Number until Number is equal to the specified Compose-Reduce.

Image reference:

16.PNG

Details of Do until:

14.PNG

Details of Condition:

15.PNG

Hope it helps.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hey 

 

Thanks for responding 

 

The given solution is not working. followed the same steps in the  example it is returning me 2019-06-30 instead of 

2019-06-26.

 

can you suggest me where it might went wrong.

Hi @PraveenH ,

 

Could you please provide full screen shoot of Flow configuration?

 

This is my test result, it works on my side:

1.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks Alot. I really Appreiate your help.

Same sample is working for me. But same flow its not working(not giving me correct business days back) when i take date field from SharePoint List which is of date time type.Instead of string.

Do i need do any string manipulations?

Hi @Praveen-H ,

 

Please show me your configuration and detailed issue.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1.JPG2.JPG3.JPG4.JPG5.JPG6.JPG7.JPG

Hi @Praveen-H ,

 

If the data source is a SharePoint list, perhaps creating a calculated column is a better choice.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
manuelstgomes
Super User
Super User

Hi @PraveenH 

I've discovered the solution to this issue for another user here on the community, and I have written a blog article that explains the solution in detail. Check it out here:
https://manueltgomes.com/microsoft/flow/find-next-business-day/

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (2,738)