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

Filter SharePoint list by date not working with eq, only with gt

I want to filter a Sharepoint list to a single item based on a date. The field is a Date without time.

 

When I use the formula

 

Filter(OnCallTeam,WeekStart >= DatePicker2.SelectedDate)

 

... I get multiple results and the blue dot. When I change the formula to equal instead of greater than and equal to ...

 

Filter(OnCallTeam,WeekStart = DatePicker2.SelectedDate)

 

... I get an error. "The requested operation is invalid. Server Response: The expression "DateField eq 2017-05-23" is not valid".

 

2017-05-24_12-31-32.png

 

How can I filter on a single date only?

 

 

 

5 REPLIES 5
Community Support Team
Community Support Team

Re: Filter SharePoint list by date not working with eq, only with gt

Hi @IngeborgNZ,

 

This should be caused by the DatePicker control.

The format under SQL Server table date column does not match the date format defined with the DatePicker control, so when conpare them with the equal sign, it will show the error message.

For more information, please check the following thread:

date filtering problem

Please take a try with the workaround mentioned by Meneghino, create a calculated integer field for the date column in the table in SQL Server with value yyyymmdd, then use text function to convert the datepicker value, and compare them:

 

Value(Text(DatePicker1.SelectedDate, "yyyymmdd")) = SQLCalculatedDateIntegerField

Another way is to use text function to convert both date value into string, which then would turn into delegation issue with the formula, that means, only the first 500 records could be filtered.

 

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

Re: Filter SharePoint list by date not working with eq, only with gt

@v-micsh-msft Have you read my question? I'm not querying SQL. This is a SharePoint data source.

 

If the >= operator works fine, why should the = operator not work????

Community Support Team
Community Support Team

Re: Filter SharePoint list by date not working with eq, only with gt

Hi @IngeborgNZ,

 

Sorry for the misleading. My bad.

SharePoint date column format also doesn't work with the DatePicker control.

Issue is similar to SQL Server, and the workaround should work, add another Text field to hold the calculated date, then compare.

>= means compare with two values, but the "=" would have more restrictions to make the expression work.

As I told above, the Type, format and value all should meet.

While when using ">=", which I think it only compare the value within the same data type, not restricted with the data format. 

 

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.
Highlighted
IngeborgNZ
Level: Powered On

Re: Filter SharePoint list by date not working with eq, only with gt

@v-micsh-msft

Sorry, but that approach does not work, either. I wrote the date into a calculated field that has 'yyyymmdd', but I still get an error when I do a comparison with "="

 

Why is this so hard? How can I get records with a specific date into an app if the underlying SharePoint list has thousands of items? If that is not possible, what are PowerApps good for?

clinton
Level: Powered On

Re: Filter SharePoint list by date not working with eq, only with gt

This worked for me.

 

Filter('OSIT - Incidents', Date_x0020_Logged <= dateSearch.SelectedDate, Date_x0020_Logged >= dateSearch.SelectedDate)

 

But it won't work with delegation, so it is a temporary fix.

 

I get the wokraround but I can't get my Calculated Column in my Sharepoint list to work.... I use =TEXT([date column], "DDMMYYYY") but doesn't work...

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (3,951)