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

Calculate Leave with Holidays and Weekends

Hello,

I would like to create a Flow to replace our existing leave request process.  One of the items we need to do is to calculate the number of business days that an employee is requesting.  This calulation needs to consider weekends and company holidays.  We currently have a SharePoint list of holidays but we do not have anything for weekdays.

 

Is there a way to accomplish this in Flow?

 

Our current workflow vendor requires a number of exasperating steps to accomplish this including making a list of all requested days, removing the days that start with the letter "S" then removing any days that are located on our holiday list.  I would love to be able to replace the software...

 

Thank you,

Matt

3 REPLIES 3
Highlighted
Community Support
Community Support

Re: Calculate Leave with Holidays and Weekends

Hi Brownmattc,

 

I am afraid that currently there is no directly way can be used to achieve your scenario.


You may have to remove the weekends first, then remove the company holidays.


This documentation about workflow definition language for your reference:
https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language


Best regards,
Mabel Mao



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

Re: Calculate Leave with Holidays and Weekends

I've got half your answer - calculating the end date, factoring in weekends. I've published a single forumula at https://sharepointgurus.net/microsoft-flow-formula-calculate-due-date-excluding-weekends/. You'll need to add two variables - startdate and duration. The formula will work out the end date.

 

Holidays can be tricky as it depends on the person's location. In Australia, different States have variations to holidays. If you are dealing with multiple countries, then that is more challenging. You'll need to get a list of appropriate holidays between your start and end date and then increase your end date by the appropriate amount. You could maintain a list in SharePoint of public holidays per region for the next 10 years and update yearly. Maybe there is an existing service out there that has all that logic built in. 

 

Ivan

Highlighted
Super User II
Super User II

Re: Calculate Leave with Holidays and Weekends

Hi @Brownmattc 

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
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,354)