cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sifu
Continued Contributor
Continued Contributor

filter gallery for time difference

Hello all,

i have a SharePoint list and powerapp with a gallery connected to the sharepont list...

above the gallery are some combo/dropdown to be used as filter... for example one of them will filter for id:

        Filter( 'Program Management',
        //sesarch of Project ID
        IsBlank(SearchID.Text) Or IsEmpty(SearchID.Text) Or ID = Value(SearchID.Text)
        )    

 In the list is are two date columns, start and end... 

I want to have one drop down where items are [ "<1", "<2" ,"<4" ] and represent the number of weeks difference between current date ( today() ) and the finish date... so if for example project x started in 1st of January and ends on 24th June, i would filter it when setting to <1.... cant work this out, any ideas are welcome

1 ACCEPTED SOLUTION

Accepted Solutions
Alex_10
Super User
Super User

@Sifu 

 

Filter(SP_list, EndDate > Today() && DateDiff(Today(), EndDate, Days) < Switch(Dropdown.Selected.Value,
"<1", 7,
"<2", 14,
"<4", 28
))

 

Please note:

- it is not delegable (only first 500 record are filtered by default, can be increased up to 2000);

- filtering is based on number of days (Not weeks. Example: today is Wednesday and if "<1"  is selected, will show records up to next Wednesday date)

 

 

View solution in original post

1 REPLY 1
Alex_10
Super User
Super User

@Sifu 

 

Filter(SP_list, EndDate > Today() && DateDiff(Today(), EndDate, Days) < Switch(Dropdown.Selected.Value,
"<1", 7,
"<2", 14,
"<4", 28
))

 

Please note:

- it is not delegable (only first 500 record are filtered by default, can be increased up to 2000);

- filtering is based on number of days (Not weeks. Example: today is Wednesday and if "<1"  is selected, will show records up to next Wednesday date)

 

 

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