Showing results for 
Search instead for 
Did you mean: 
Resolver I
Resolver I

Find the dates between two dates excluding weekends

Hi folks, 


I noticed that the DateDiff calculation between two dates excluding weekends and holidays are well documented. I'm having an app that allow the users to pick a start date and end date for a task, and the task could be repetitive. So I'd like to find out the number of recurrences between the 2 dates excluding weekends, and most importantly to find out which exact dates they are. 


Here my code:

//DataCardValue9 is Start Date;
//DataCardValue10 is End Date;
//_NoOfSelected is the number of days where the task is repeating. Eg every 2 days, _NoOfSelected is 2;
Set(_Frequency, RoundDown((RoundDown(DateDiff(DataCardValue9.SelectedDate, DateValue(DataCardValue10.SelectedDate), Days) / 7, 0) * 5 + Mod(5 + Weekday(DateValue(_RepeatUntilSelected)) - Weekday(DataCardValue9.SelectedDate),5)) / _NoOfSelected, 0));
        Value < _Frequency
    Collect(_tempText, If(Weekday(DateAdd(DataCardValue9.SelectedDate, Value * _NoOfSelected)) = 1 Or Weekday(DateAdd(DataCardValue9.SelectedDate, Value * _NoOfSelected)) = 7, DateAdd(DataCardValue9.SelectedDate + 2, Value * _NoOfSelected), DateAdd(DataCardValue9.SelectedDate, Value * _NoOfSelected)));

Obviously ... this code is not correct ... but I have no clue how to find out the exact dates. 


Please give me some advice 🙂 




Community Support
Community Support

Hi @gavinleung ,


Did you mean that you want to find how many tasks start and end on the same day during one period of time? And also extract the dates between the start and end dates?




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

Hi @v-monli-msft , not exactly. 


Say eg Task A will start on 20/9, and repeating every 2 days until 30/9. Weekends shouldn't be taken. That means Task A shall happen on 20/9, 24/9, 26/9 and 30/9. So the code I provided is to calculate the number of recurrence of this task, ie 4 times. But now, I don't know the code that I could extract these 4 dates and adding to a Sharepoint List.  

Helpful resources

PA 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

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (47,209)