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

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

@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
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,448)