web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Can not filter SharePo...
Power Apps
Answered

Can not filter SharePoint list on date using equals but greater/less than works

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Earlier I was trying to build a feature to prevent a user from entering more than one item on the same date. To do this, I was using a filter against my SharePoint data source date field where the date indicated in the form is compared in order to give them access to the submit button. The equation will resolve to a true/false. 

 

For some reason, I could not use the equals operator like so: 

 

Does not work

 

CountRows(
 Filter(TimeStudy,
 EntryDate = DataCardValue10.SelectedDate
 )
) <> 0

 

It shows the error:

The requested operation is invalid. Server Response: The expression "Date eq 2019-10-24" is not valid. 

 

With a bit of creativity, I tried doing a comparison instead and achieved the desired result using something much uglier.

 

Works fine

CountRows(
 Filter(TimeStudy,
 EntryDate < DateAdd(DataCardValue10.SelectedDate, 1),
 EntryDate > DateAdd(DataCardValue10.SelectedDate, -1)
 )
) <> 0

 

Can anyone provide some insight on what might be happening here? I read some other threads about limitations and workarounds with SharePoint lists. Is this realated? None of the date fields have a time associated with them so I don't think that's the issue.

 

 

Categories:
I have the same question (0)
  • Verified answer
    Pstork1 Profile Picture
    69,415 Most Valuable Professional on at

    This is a common issue.  The problem is that Dates, even Date only fields, are always Date and Time values.  So if you are trying to check equals then you will almost never get a match on the time portion.  To use equals you have to filter out the time portion of both sides of the equals and compare just the date strings.  Like this

    CountRows(
     Filter(TimeStudy,
     Text(EntryDate, ShortDate) = Text(DataCardValue10.SelectedDate, ShortDate)
     )
    ) <> 0
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you for the explination. I had tried a similar approach but guess I didn't get the syntax correct. 

  • vwyankee Profile Picture
    360 on at

    In case someone else comes by this like me and it didn't quite give the solution... I had a similar scenario, but this didn't work for me as it results in a delegation warning. Whether I was using CountRows or LookUp operators, as soon as I put the Text operator in there the delegation warning would show.

     

    In my scenario the user selects a date and an employee and we want to prevent more than one entry for the same date with the same employee selected. Going with a similar approach @Anonymous listed that worked for him initially I was able to get the result I needed. I'm creating two variables and then comparing them against each other. I put this in the OnChange property of both my date picker and employee combo box.

     

     

    UpdateContext({varDateSelected: Text(ddDate.SelectedDate, ShortDate), varSPDate: Text(LookUp(SPList, Date>ddDate.SelectedDate-1 And Date<ddDate.SelectedDate+1 And Employee=cbEmpName.Selected.Employee).Date, ShortDate)});
    If(varDateSelected = varSPDate, UpdateContext({varDuplicateFound: true}), UpdateContext({varDuplicateFound: false}))

     

     

    I then set the display mode of the save/submit button based on the variable varDuplicateFound.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,033

#2
Valantis Profile Picture

Valantis 632

#3
11manish Profile Picture

11manish 607

Last 30 days Overall leaderboard