cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
David_89
Frequent Visitor

Drop Down Date Filter not showing Todays records

So I'm trying to filter a gallery and I have drop down date selector which uses a collection to create the Start and End dates.

I can filter for Yesterday, This Week, Last Week, This Month fine but it just won't show any Today records.  Yes I do have records in their to display.

So I create a collection On Start to create the time filters:

David_89_4-1635128780040.png

 


In my Gallery I'm filtering like this:

David_89_0-1635128657369.png

So here is the view of the gallery with nothing selected:

David_89_1-1635128702034.png

And when I selected Today:

David_89_2-1635128733777.png


But when I select like This Week:

David_89_3-1635128757438.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
Eelman
Community Champion
Community Champion

@David_89 

The issue here is that your filter is trying to compare DATE ONLY values (from your OnStart collection) with DATE TIME values in your gallery. A simple fix is to wrap your TimeIn and TimeOut gallery values is a formula that returns a date only, something like this:

 

// for TimeIn
DateValue(Text(TimeIn,DateTimeFormat.ShortDate)) ...

// for TimeOut
DateValue(Text(TimeOut,DateTimeFormat.ShortDate)) ...

 

The reason for this is that when you set Today() in your OnStart collection it also set the time as 12:00AM, hence when you try to compare a gallery value to your "Today" dropdown selection it's looking for any date_time values from:

 

StartDate: 25/10/2021 12:00AM to

EndDate: 25/10/2021 12:00AM ... so the same time of day, if that makes sense?

 

View solution in original post

2 REPLIES 2
Eelman
Community Champion
Community Champion

@David_89 

The issue here is that your filter is trying to compare DATE ONLY values (from your OnStart collection) with DATE TIME values in your gallery. A simple fix is to wrap your TimeIn and TimeOut gallery values is a formula that returns a date only, something like this:

 

// for TimeIn
DateValue(Text(TimeIn,DateTimeFormat.ShortDate)) ...

// for TimeOut
DateValue(Text(TimeOut,DateTimeFormat.ShortDate)) ...

 

The reason for this is that when you set Today() in your OnStart collection it also set the time as 12:00AM, hence when you try to compare a gallery value to your "Today" dropdown selection it's looking for any date_time values from:

 

StartDate: 25/10/2021 12:00AM to

EndDate: 25/10/2021 12:00AM ... so the same time of day, if that makes sense?

 

David_89
Frequent Visitor

I thought as much when I was setting the hard codes for Today(), but yeah I have added that code you mentioned into my Items filter so it is comparing the dates rather than the times also.

Thank you very much I have learnt something new on my journey in powerapps!

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (1,525)