cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
SharePointAU
Level: Powered On

Only show item if date is within date range

I'm looking at an on call list from SharePoint. 

 

I am using the Event ContentType and StartDate and EndDate from that type to show data on the dashboard screen. This will show the current On Call person, and the next On Call person. A person is on call for 1 week (Monday - Sunday)

 

If "StartDate" is within this week. I need to show the "Title" of that item.

I also, need to show the Next On Call (for next week).

 

Capture.PNG

2 ACCEPTED SOLUTIONS

Accepted Solutions
Community Support Team
Community Support Team

Re: Only show item if date is within date range

Hi @SharePointAU,

 

Which control that you would like to use here to show the On called Person?

Would you please share more information about the On Call list?

If the On Call list contains the distinct User Name, then we could take use of the lookup function to find the user name:

For example, with the TextBox text property, we could write the formula in the following way for Current Week:

Lookup(OnCall List, 
And(
DateDiff(DateAdd(Now(),-Weekday(Now(),11)),DateValue('Start Date'))>0,
DateDiff(DateAdd(Now(),7-Weekday(Now(),11)),DateValue('Start Date'))<=0
)           
).PersonName

For the Next week, formula should be:

Lookup(OnCall List, 
And(
DateDiff(DateAdd(Now(),7-Weekday(Now(),11)),DateValue('Start Date'))>0,
DateDiff(DateAdd(Now(),14-Weekday(Now(),11)),DateValue('Start Date'))<=0
)           
).PersonName

Explanation for the formula:

Lookup function is used to find the proper record, and function is used to check if the start Date is within the needed week.

If there are several people Scheduled in the current week, then please consider change the Lookup function with Filter or search function, which then would return a table, and instead, change the text control with a dropdown or a list box.

Regards,

Michael

Community Support Team _ Michael Shao
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

SharePointAU
Level: Powered On

Re: Only show item if date is within date range

I found it. I was trying to use StartDate as text in the DateValue, but StartDate is already date/time. So i replaced "DateValue(StartDate)" with just "StartDate" and i get the correct response!

 

Now do you know why i'm still getting the informational warning shown below?

-NOTE: The output is correct, but I am receiving this warning.

Capture.PNG 

View solution in original post

5 REPLIES 5
Community Support Team
Community Support Team

Re: Only show item if date is within date range

Hi @SharePointAU,

 

Which control that you would like to use here to show the On called Person?

Would you please share more information about the On Call list?

If the On Call list contains the distinct User Name, then we could take use of the lookup function to find the user name:

For example, with the TextBox text property, we could write the formula in the following way for Current Week:

Lookup(OnCall List, 
And(
DateDiff(DateAdd(Now(),-Weekday(Now(),11)),DateValue('Start Date'))>0,
DateDiff(DateAdd(Now(),7-Weekday(Now(),11)),DateValue('Start Date'))<=0
)           
).PersonName

For the Next week, formula should be:

Lookup(OnCall List, 
And(
DateDiff(DateAdd(Now(),7-Weekday(Now(),11)),DateValue('Start Date'))>0,
DateDiff(DateAdd(Now(),14-Weekday(Now(),11)),DateValue('Start Date'))<=0
)           
).PersonName

Explanation for the formula:

Lookup function is used to find the proper record, and function is used to check if the start Date is within the needed week.

If there are several people Scheduled in the current week, then please consider change the Lookup function with Filter or search function, which then would return a table, and instead, change the text control with a dropdown or a list box.

Regards,

Michael

Community Support Team _ Michael Shao
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

SharePointAU
Level: Powered On

Re: Only show item if date is within date range

This is a great help, as it points me in a direction I had not known existed with the Lookup. 

The On Call List is a SharePoint OnPrem list, that has 1 person on call each week. StartDate is the default date/time field provided by the Event Content Type.

 

I have applied your formula to a Text box, but receive the following error. 

Error:

 

Capture.PNG

 

Forumla as applied

LookUp('OnCallList', 
And(DateDiff(DateAdd(Now(),-Weekday(Now(),11)),DateValue(StartDate))>0,
DateDiff(DateAdd(Now(),7-Weekday(Now(),11)),DateValue(StartDate))<=0)).AssignedTo_Text
SharePointAU
Level: Powered On

Re: Only show item if date is within date range

I found it. I was trying to use StartDate as text in the DateValue, but StartDate is already date/time. So i replaced "DateValue(StartDate)" with just "StartDate" and i get the correct response!

 

Now do you know why i'm still getting the informational warning shown below?

-NOTE: The output is correct, but I am receiving this warning.

Capture.PNG 

View solution in original post

Mike02
Level: Powered On

Re: Only show item if date is within date range

Hi,

 

Good day!

 

I am new in Powerapps and I have similar issue with the above.

 

I created an attendance list in sharepoint online with 4 columns ("Created By", "Reason for Leave", "From" & "To").

Now I want to create an app in powerapps to show only those persons who are on leave today with reason  and with "From" & "To". Is this possible? 

 

Thank you in advance.

 

Mike

SharePointAU
Level: Powered On

Re: Only show item if date is within date range

Yes, That is similar to what I was trying to do. You'll need to use a formula similar to the ones above.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,102)