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
PeteMc
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
PeteMc
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
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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

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

Top Solution Authors
Top Kudoed Authors
Users online (100,712)