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 / Filter Date in SQL usi...
Power Apps
Answered

Filter Date in SQL using DatePicker in PowerApps

(0) ShareShare
ReportReport
Posted on by 19

Hi,

 

i am trying to filter SQL DB based on DatePicker on PowerApps. The Format of the Date is SQL Date is yyyy-mm-dd. When i try Below Formula it returns nothing

 

Filter(SQLDB,DateOfBirth=DatePicker3.SelectedDate)

i changed the formula a bit and this time i only get 2000 records

Filter(AddColumns(SQLDB,"datecon",Year(DateOfBirth) * 10000 + Month(DateOfBirth) * 100 + Day(DateOfBirth)),datecon=value(Year(DatePicker3.SelectedDate) * 10000 + Month(DatePicker3.SelectedDate) * 100 + Day(DatePicker3.SelectedDate))

 

 

DB is PDW and literally i cannot modify/update it. 

 

is there still any workound to be able to filter SQLDB by date?

 

SQLDB has over 2mil records

 

Thanks

 

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Raif8522 

    AddColumns() is not delegatable. The problem is not with Filter() which is.

  • Raif8522 Profile Picture
    19 on at

    Unfortunately, i can only Read from DB. I don't think create/merge any columns there 😕

    is there anyway to create a Date(Same format as in SQLDB) from string and pass it to the Filter as a Date, not as a text?

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Raif8522 

    Can you rewrite your formula without the AddColumns()?

  • Raif8522 Profile Picture
    19 on at

    @Drrickryp 

    if you meant like below, yeah but it gives delegation warning.

    Filter(SQLDB,Year(DateOfBirth) * 10000 + Month(DateOfBirth) * 100 + Day(DateOfBirth)=Year(DatePicker3.SelectedDate) * 10000 + Month(DatePicker3.SelectedDate) * 100 + Day(DatePicker3.SelectedDate))
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Raif8522 

    Try

    Filter(
     SQLDB,DateOfBirth=DateValue(
     DatePicker3.SelectedDate,"en-US"
     )
    )
    Or try
    Filter(
     SQLDB,DateOfBirth=DateTimeValue(
     DatePicker3.SelectedDate,"en-US"
     )
    )

    It depends on how the DateOfBirth column is formatted in SQL.  Since I don't use SQL, I tried it on a SharePoint column in a 5000 item list and it worked for the second formula

     

  • Raif8522 Profile Picture
    19 on at

    No Luck @Drrickryp Below is the DateOfBirth column from SQL. it is a Date column but format is different. Your formula doesn't give any errors nor returns any customers. 

    Raif8522_0-1653930970644.png

     

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Raif8522 

    Filter(
     SQLDB,DateOfBirth=Text(DateValue(
     DatePicker3.SelectedDate,"yyyy-mm-dd"
     )
    )
  • Raif8522 Profile Picture
    19 on at

    @Drrickryp 

    "Incompatible types of comparison. These types can't be compared:Date,Text"...

    Even following formulas doesn't work

    Filter(
     SQLDB,DateOfBirth=DateValue(Text(DateValue(
     DatePicker3.SelectedDate,"yyyy-mm-dd"
     )
    ),"en-GB"))

    or 

    Filter(
     SQLDB,Text(DateOfBirth)=Text(DateValue(
     DatePicker3.SelectedDate,"yyyy-mm-dd"
     )
    ))

    Stucked on that...

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Raif8522 

    I'm at a loss.  Time to see if @CarlosFigueira has an answer. 

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Raif8522 

    I'm at a loss.  Time to see if @CarlosFigueira has an answer. 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#2
11manish Profile Picture

11manish 205 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard