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

Filter SharePoint list on Date value not working (Date column works like text?)

So, I have a SharePoint list with a Date column (no time) and in PowerApps I have the built in Date Picker to select a date and then in a gallery I want to show all list items for the selected date.

 

When I click a date in the date picker we set the date like this:

 

Set(_dateSelected, DateAdd(_firstDayInView, ThisItem.Value, Days))

 

 

This is all according to the default date picker set up, I have not changed anything.

 

The date column in my SharePoint list is simply called "Date" and is of date type:

Skärmklipp.JPG

 

Now, in my gallery I should be able to filter the Date column like this:

 

Filter(Reports, Date=_dateSelected)

 

 

However, this gives the following error:

Skärmklipp.JPG

(note the date format "yyyy-mm-dd")

 

If I convert the date to a text string the filtering suddenly works:

 

Filter(Reports, Date=Text(_dateSelected, "yyyy-mm-dd"))

 

 

It works, but PowerApps says they are of different types:

Skärmklipp.JPG 

 

...and when the users log in to the app they get this:

Skärmklipp.JPG

 

I've tried multiple work arounds, for example I created a calculated text column that converts the date column to a string in the format of "yyyy-mm-dd", then I try to filter on this column in PowerApps with a text version:

 

Filter(Reports, 'Date (Text)'=Text(_dateSelected, "yyyy-mm-dd"))

 

 

Then I get a delegation warning instead, which I shouldn't get on a text column:

Skärmklipp.JPG

 

So, what am I doing wrong when I'm filtering SharePoint for dates? Should I somehow convert the format of the date to make it work?

 

In SharePoint the dates look like this (at least for my user): "mm/dd/yyyy". If I put the _dateSelected into a label it shows the same format. However, in the filtering you can clearly see it tries to filter with "yyyy-mm-dd" (as I noted earlier).

 

I'm not sure how to solve this, I've tried every possible solution I could come up with and find through searching.

 

Thanks in advance!

1 REPLY 1
WarrenBelz
Level 8

Re: Filter SharePoint list on Date value not working (Date column works like text?)

Hi @aldenniklas ,

I am assuming you want to filter a gallery from a DatePicker called _dateselected.

Firstly, Date queries are not delegable - there are workarounds, but I will deal with this initially on the basis you can collect with a delegable query a list of records less than 2000 items - I will call this colReports. You should rename the SharePoint field you call Date to something like ReportDate.

The Items property of the gallery would be

Filter(
   colReports,
   ReportDate = _dateselected.SelectedDate
)

 Please let me know if this suits what you are wanting to achieve.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

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,273)