cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Filter Data Table by Date Range

Hi all,

 

I am currently trying to filter a data table by a date range which is manually chosen by the user of the app. They have two date pickers, one is the start of the date range and the second is the end of the date range. I cannot get the second date picker (the one that selects the end of the date range) to work. I think there might be something wrong with the format of the date/time of the date picker but I cannot work out what it is.

 

The data table is filtered like this:

 

Filter(
FinanceTimeLog,
(
(IsBlank(NamePicker_1.Selected.UserPrincipalName) || AgentID = NamePicker_1.Selected.UserPrincipalName)

 

&&

(IsBlank(TeamPicker_1.Selected.Result) || Title = TeamPicker_1.Selected.Result)

 

&&

 

(CategoryPicker_1.Selected.Result = "All" || ok6e = CategoryPicker_1.Selected.Result)

 

&&

 

StartTime >= DatePicker2.SelectedDate

&&

StartTime <= DatePicker2_1.SelectedDate
))

 

You can see from the screenshots that when I change the second date picker to the date of the ticket that was logged, the item does not show in the table. Even though the filter is for: StartTime <= DatePicker2_1.SelectedDate.

 

This part of the formula: StartTime >= DatePicker2.SelectedDate works perfectly.

 

freddiejoseph1_1-1619515355323.png

Above the date of the ticket is 26/04/2021 and both the date filters work perfectly. However, if I change the End Date datepicker (datepicker2_1) to 26/04/2021, the item does not show up:

freddiejoseph1_2-1619515466814.png

 

Any help would be much appreciated.

 

Thanks,

 

Freddie

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User
Super User

Hi @Anonymous 

I think the problem is that the target record that you want to display has a date of '26/04/2021 08:55' (notice the time component).

Most likely, your end date criteria has a time component of 00:00, which would explain why you don't see your expected record in the result.

If you want to show all records that were created on the 26/04/2021 up to 23:59, an easy option would be to modify your logic to test for an end date of < 27/04/2021.

&& StartTime < DateAdd(DatePicker2_1.SelectedDate,1)


You may need to add the 1 day in a With block or variable if your formula shows a delegation warning with this technique.

View solution in original post

2 REPLIES 2
timl
Super User
Super User

Hi @Anonymous 

I think the problem is that the target record that you want to display has a date of '26/04/2021 08:55' (notice the time component).

Most likely, your end date criteria has a time component of 00:00, which would explain why you don't see your expected record in the result.

If you want to show all records that were created on the 26/04/2021 up to 23:59, an easy option would be to modify your logic to test for an end date of < 27/04/2021.

&& StartTime < DateAdd(DatePicker2_1.SelectedDate,1)


You may need to add the 1 day in a With block or variable if your formula shows a delegation warning with this technique.

Anonymous
Not applicable

That works. Thanks a lot 🙂 

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,505)