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

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
Level: Powered On

Re: Filter with a if and selected date

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
Super User
Super User

Re: Filter with a if and selected date

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
Level: Powered On

Re: Filter with a if and selected date

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

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

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