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

Scheduling a date depending on request submit date

I am creating an app based on a sharepoint list that has two date columns. One of these dates take in the date a reqest is submitted and the for the other I want it to be a date calculated based on the first column. 

 

I am trying to write an if statement that says if the submit date is before Tuesday and after Thursday, the request is scheduled to be discussed for this Thursday, otherwise the request is scheduled for next Thursday. 

 

I am not sure how to translate that into an if statement that returns a date.

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Scheduling a date depending on request submit date

Hi @Anonymous ,

Could you describe more clearly about "before Tuesday and after Thursday"?

Do you means that before this week Tuesday and after last week Thursday?

I'm a little confused about the rule that you described.

I assume the beginning of the week is Sunday.

According to my userstanding, if the request submitted date is last week's Firday and Satday and this week's Sunday and monday then the request is scheduled in this week.

To sum up, only the request submit on this week's Sunday and Monday, the request is scheduled in this week, otherwise next week.

Here's formula that I used:

If(Weekday(listname.requestsubmit)<=2,listname.requestsubmit-Weekday(listname.requestsubmit)+5,
listname.requestsubmit-Weekday(listname.requestsubmit)+12)

 

Best regards,

Community Support Team _ Phoebe Liu

 

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

View solution in original post

2 REPLIES 2
Highlighted
Helper I
Helper I

Re: Scheduling a date depending on request submit date

The first idea I have, is to get the date selected week number and then either import a table that has the week numbber and Thursday date or use Switch. 

 

So to get week number, I added a label titled "DateSelectedWeek" and entered this formula:

 

RoundUp((DatePicker1.SelectedDate - Date(Year(DatePicker1.SelectedDate), 1, 1) + (Weekday(Date(Year(DatePicker1.SelectedDate), 1, 1), Monday))) / 7, 0)

 

Then to determin if it would be scheduled this week or next week, I added a label titled "RequestScheduledWeek" and entered this formula:

 

If(Weekday(DatePicker1.SelectedDate) < 4, Value(DateSelectedWeek.Text), Value(DateSelectedWeek.Text) + 1)

 

Sunday is 1, so we want anything before Wednesday (4) to be scheduled this week and anything after to be next week. 

 

Then in your Schedule Request Date field, you have the formula entered as:

 

Switch(Value(RequestWeek.Text), 26, Date(2019,6,27),27, Date(2019,7,4))

 

I only entered this week and next as an example, but you would do the whole year or instead of switch, import the table of data and use LookUp. 

 

 

Highlighted
Community Support
Community Support

Re: Scheduling a date depending on request submit date

Hi @Anonymous ,

Could you describe more clearly about "before Tuesday and after Thursday"?

Do you means that before this week Tuesday and after last week Thursday?

I'm a little confused about the rule that you described.

I assume the beginning of the week is Sunday.

According to my userstanding, if the request submitted date is last week's Firday and Satday and this week's Sunday and monday then the request is scheduled in this week.

To sum up, only the request submit on this week's Sunday and Monday, the request is scheduled in this week, otherwise next week.

Here's formula that I used:

If(Weekday(listname.requestsubmit)<=2,listname.requestsubmit-Weekday(listname.requestsubmit)+5,
listname.requestsubmit-Weekday(listname.requestsubmit)+12)

 

Best regards,

Community Support Team _ Phoebe Liu

 

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

View solution in original post

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,142)