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 / Filtering a Dataverse ...
Power Apps
Answered

Filtering a Dataverse table with date

(0) ShareShare
ReportReport
Posted on by 110
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)
  • Verified answer
    WarrenBelz Profile Picture
    154,797 Most Valuable Professional on at
    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   
  • Suggested answer
    Inogic Profile Picture
    1,265 Moderator on at
    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
  • randomsky Profile Picture
    110 on at
    Thanks @WarrenBelz, that fixed it and is consistent. 
    Thanks @Inogic, this seems to work but gives a delegation warning so @WarrenBelz 's solution is preferred.

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard