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 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.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

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.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,024)