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

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!


Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (52,271)