Showing results for 
Search instead for 
Did you mean: 
Helper III
Helper III

How to exclude the weekend from date range

Hi All, 

I want to exclude the weekends and calculate the remaining dates in a date range.

Currently, I m using addDays function as follows in two conditions. But this is only adding 10 days(without considering number of weekend days)  if RemainigDaysVariable > 10 days (1st condition) or calculate the remaining days if RemainigDaysVariable< 10 days (2nd condition)

in 1st condition 



in 2nd condition


Following are the variables I have used on the 2nd condition

RemainigDaysVariable-> div(sub(variables('WindowEnd'),outputs('Compose2')),864000000000)

Compose2-> ticks(variables('ApprovedDateVariable'))



But now what I want to do is based on the ApprovedDateVarible I want to calculate the remaining business days and assigned that value to RemainigBusinessDaysVariable

Then If the RemainigBusinessDaysVariable> 10 business days 

then addDays(utcNow(),Add10Businessdays,'dd-MM-yyyy')<--- condition 1

else addDays(utcNow(),variables('RemainigDaysVariable'),'dd-MM-yyyy')


Much appreciate your help. 


Super User II
Super User II


Hi there.  I might not be clear on the question, but since 10 business days is basically two weeks, could you not just add 14 days?


Keep us posted.




If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.



Thanks for your reply.


But how can I calculate the RemainigDaysVariable-> div(sub(variables('WindowEnd'),outputs('Compose2')),864000000000) correctly excluding weekends.

for example, if I get approval today which is 15/11/2019 and the WindowEnd date is 27/11/2019, the number of RemainigDaysVariable must be 8 days(excluding weekends), but based on my above calculation the number of RemainigDaysVariable is 12 days wich is incorrect.

Can you please tell me how to correct this.


Super User II
Super User II


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:

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


Helpful resources

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.

Top Solution Authors
Top Kudoed Authors
Users online (7,881)