cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

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
Highlighted
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
Highlighted
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
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,702)