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.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,370)