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

Filter on Date Picker not working

I'm connecting to a table from a SQL Server database.  It has a few fields, with one of them being a date (WorkedDate, date datatype).

 

I'm loading that data into a gallery to display it, so I attempted a filter:

Filter(
'[AUDIT].[FBCountSheet]',
WorkedDate = DatePicker1.SelectedDate
)

 

This does not seem to work at all.  My best guess was that it was returning a datetime from the date picker, so I tried doing a DATE(YEAR(),MONTH(),DAY()) wrapper on the Selected Date value to no avail. I have tested the filter on other columns (location, which is an int), but date is the only one that's not working.

 

Bonus question- is there really no way to type in your date on the date picker?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Filter on Date Picker not working

@dungar 

If the date exists in the SQL database but you are not finding any matches it is likely because the date formats difference between SQL and PowerApps.  For example lets say your dates have the following formats.

 

SQL: yyyy-mm-dd hh:mm:ss
PowerApps: m/d/yyyy

 

The solution would be to format the PowerApps date similar to the SQL format.  By the way, many times a date within SQL is stored as plain-text

 

Filter(
    '[AUDIT].[FBCountSheet]',
    WorkedDate = Text(DatePicker1.SelectedDate, "yyyy-mm-dd hh:mm:ss")
)

 

Note: you might have to take a peek at the database tables in SQL to confirm the actual format.

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

1 REPLY 1
Super User
Super User

Re: Filter on Date Picker not working

@dungar 

If the date exists in the SQL database but you are not finding any matches it is likely because the date formats difference between SQL and PowerApps.  For example lets say your dates have the following formats.

 

SQL: yyyy-mm-dd hh:mm:ss
PowerApps: m/d/yyyy

 

The solution would be to format the PowerApps date similar to the SQL format.  By the way, many times a date within SQL is stored as plain-text

 

Filter(
    '[AUDIT].[FBCountSheet]',
    WorkedDate = Text(DatePicker1.SelectedDate, "yyyy-mm-dd hh:mm:ss")
)

 

Note: you might have to take a peek at the database tables in SQL to confirm the actual format.

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Helpful resources

Announcements
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

Top Solution Authors
Top Kudoed Authors
Users online (6,105)