cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

DateAdd excluding weekends

Hi,

 

I have DatePicker2 wherein the default value comes from DatePicker1 + 15days. Can someone help me out exclude saturday and sunday when adding the 15 days to the selected date on DatePicker1?

 

Scenario:

 

DatePicker1 = 07/02/2018

DatePicker2 = 07/02/2018 + 15 days (excluding saturday & sunday)

 

Please help,

 

Thanks in advance

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Resolver I
Resolver I

Find sample app attached. What I did:

Set the onChange on datepicker1 to:

 

Set(DateCalcTable,AddColumns(Table({ID:1},{ID:2},{ID:3},{ID:4},{ID:5},{ID:6},{ID:7},{ID:8},{ID:9},{ID:10},{ID:11},{ID:12},{ID:13},{ID:14},{ID:15},{ID:16},{ID:17},{ID:18},{ID:19},{ID:20}),"WeekDayCol",Weekday(DateAdd(DatePicker1.SelectedDate,ID,Days))));
Set(NewDate,DateAdd(DatePicker1.SelectedDate,Last(FirstN(Filter(DateCalcTable,WeekDayCol > 1 && WeekDayCol < 7),15)).ID,Days));
Set(resetDatePicker2, true);
Set(resetDatePicker2, false)

Set the reset on DatePicker2 to: 

resetDatePicker2

Set the default on DatePicker2 to  

NewDate

 

View solution in original post

2 REPLIES 2
Resolver I
Resolver I

Find sample app attached. What I did:

Set the onChange on datepicker1 to:

 

Set(DateCalcTable,AddColumns(Table({ID:1},{ID:2},{ID:3},{ID:4},{ID:5},{ID:6},{ID:7},{ID:8},{ID:9},{ID:10},{ID:11},{ID:12},{ID:13},{ID:14},{ID:15},{ID:16},{ID:17},{ID:18},{ID:19},{ID:20}),"WeekDayCol",Weekday(DateAdd(DatePicker1.SelectedDate,ID,Days))));
Set(NewDate,DateAdd(DatePicker1.SelectedDate,Last(FirstN(Filter(DateCalcTable,WeekDayCol > 1 && WeekDayCol < 7),15)).ID,Days));
Set(resetDatePicker2, true);
Set(resetDatePicker2, false)

Set the reset on DatePicker2 to: 

resetDatePicker2

Set the default on DatePicker2 to  

NewDate

 

View solution in original post

Anonymous
Not applicable

Thank you so much

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

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

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (90,511)