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

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

Filtering a Dataverse table with date

(0) ShareShare
ReportReport
Posted on by 103
I have a Dataverse table with a date only field called entryDate that is used in a canvas app gallery. In the gallery items property I use this:
 
Filter(tblLedgers,entryDate=Text(DatePickerCanvas2.SelectedDate,"yyyy-mm-dd"))
 
To my surprise this works but gives a warning saying: Incompatible types for comparison. These types can't be compared: DateTime, Text.
 
I was expecting this to work but it doesn't:
 
Filter(tblLedgers,entryDate=DatePickerCanvas2.SelectedDate)
 
and neither does:
 
Filter(tblLedgers,entryDate=DateValue(DatePickerCanvas2.SelectedDate))
 
the last two filter expressions don't give any warnings but simply don't return any records.
 
I even tried using another filter with entryDate >= DatePickerCanvas2.SelectedDate, entryDate < DateAdd( DatePickerCanvas2.SelectedDate, 1) with this showing some records but is not consistent.
 
I'm very confused. Anyone else experience this?
 
Categories:
I have the same question (0)
  • Suggested answer
    Inogic Profile Picture
    1,057 Super User 2025 Season 2 on at
    Filtering a Dataverse table with date
    Hi,
     
    You can try the following formula:

    Filter(
        tblLedgers,
        DateValue(entryDate) = DatePickerCanvas2.SelectedDate
    )

    Using DateValue(entryDate) removes the time portion from the Dataverse DateTime value, ensuring that the comparison is done correctly as date vs. date.

    Hope this helps!
     
    Thanks!
    Inogic
  • WarrenBelz Profile Picture
    150,314 Most Valuable Professional on at
    Filtering a Dataverse table with date
    My understanding is that Dataverse stores dates in UTC time, so your second exercise with adding a day is on the right track. You need to find the start of the day - try this OnChange of the Date Picker 
    UpdateContext(
       {
          varStart: DateAdd(
             Self.SelectedDate,
             TimeZoneOffset(Now()),
             TimeUnit.Minutes
         )
      }
    );
    UpdateContext(
       {
          varEnd: 
          DateAdd(
             varStart,
             24,    
             TimeUnit.Hours
          )
       }
    )
    then test for the date being between these.
     
    Please ✅ Does this answer your question 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 a Like♥.
    Visit my blog
    Practical Power Apps    LinkedIn   

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 977 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 386 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 345

Last 30 days Overall leaderboard