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

Filter with a if and selected date

Hi,

I'm trying to do a filter on user().email and a specific date if any date is chosen. 

If no date is chosen, filter should only be on user().email

I have a date picker field: ProjWrkOv_Datefilter

I have a button to reset that field to nothing with Reset(ProjWrkOv_Datefilter)

Code like below on items of gallery.

 

Filter only works if I chose a date, if not, I get no items

 

Filter('[dbo].[ProjWork]',
Employee = User().Email && 
        If(ProjWrkOv_Datefilter.SelectedDate > DateValue("01/01/1970"),
        Text(Date,ShortDate) = Text(ProjWrkOv_Datefilter.SelectedDate,ShortDate),
        true)
)

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
MadW
Helper I
Helper I

Hi,

Found the error.

Even though I have put a label in to show me picked date, I had error with inputtextplaceholder showing 31/12/2001. So my date was always larger than "01/01/1970".

Deleted everything on placeholder and filter worked like a charm. 

View solution in original post

2 REPLIES 2

Can you try this? 

Filter('[dbo].[ProjWork]', Employee = User().Email && If(!IsBlank(ProjWrkOv_Datefilter) && ProjWrkOv_Datefilter.SelectedDate > DateValue("01/01/1970"), Text(Date,ShortDate) = Text(ProjWrkOv_Datefilter.SelectedDate,ShortDate), true) )

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
https://www.thepoweraddict.com

MadW
Helper I
Helper I

Hi,

Found the error.

Even though I have put a label in to show me picked date, I had error with inputtextplaceholder showing 31/12/2001. So my date was always larger than "01/01/1970".

Deleted everything on placeholder and filter worked like a charm. 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,466)