cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Resolver I
Resolver I

Re: DateAdd excluding weekends

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
Highlighted
Resolver I
Resolver I

Re: DateAdd excluding weekends

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

Highlighted
Anonymous
Not applicable

Re: DateAdd excluding weekends

Thank you so much

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

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.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,886)