cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
v-yutliu-msft
Community Support
Community Support

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
yshariff
Advocate I
Advocate I

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. 

 

 

v-yutliu-msft
Community Support
Community Support

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.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (2,998)