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
Community Support Team
Community Support Team

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
yshariff
Level: Powered On

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. 

 

 

Community Support Team
Community Support Team

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
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 51 members 3,392 guests
Please welcome our newest community members: