Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Filter Gallery with Multiple Conditions avoid Delegation

(1) ShareShare
ReportReport
Posted on by 583
I need to filter a gallery using multiple controls independently and together. One constant filter is I only want records with an entry date. Then I need to be able to filter that with a start date picker an end date picker and a combobox. All need to work independently and together. So if nothing the start date then everything with an entry date before and after but if I add a start date then only thing equal to or greater. Same with the end date and if both are selected then in between the two. Also if the CB is empty then no filter on the category column but if selected then it filters based on that also with the date pickers. Finally to top that all off I'm trying to avoid delegation functions. Can anyone help with this?
Categories:
  • Suggested answer
    SaiRT14 Profile Picture
    1,961 Super User 2025 Season 1 on at
    Filter Gallery with Multiple Conditions avoid Delegation
    Filter(
       'Tube Mill Data',
       (IsBlank(DatePicker1.SelectedDate) || 'Date of Maintenance' >= DatePicker1.SelectedDate) &&
       (IsBlank(DatePicker1_1.SelectedDate) || 'Date of Maintenance' <= DatePicker1_1.SelectedDate) &&
       (IsBlank(ComboBox1.Selected.Value) || 'Maintenance Performed' = ComboBox1.Selected.Value)
    )
  • StephenGW Profile Picture
    583 on at
    Filter Gallery with Multiple Conditions avoid Delegation
    Warren,
     
    I am sorry about my confusion. Thank you for being patient with me and once again giving me the solution that I needed. It works as intended now.
  • Verified answer
    WarrenBelz Profile Picture
    146,651 Most Valuable Professional on at
    Filter Gallery with Multiple Conditions avoid Delegation
    The whole point is that you keep changing things you had correct previously - the correct code should be
    Filter(
       'Tube Mill Data',
       (
          Value(DatePicker1.SelectedDate) < 1 ||
          'Date of Maintenance' >= DatePicker1.SelectedDate
       ) &&
       (
          Value(DatePicker1_1.SelectedDate) < 1 ||
          'Date of Maintenance' <= DatePicker1_1.SelectedDate
       ) &&
       (
          Len(ComboBox1.Selected.Value) = 0 ||
          'Maintenance Performed' = ComboBox1.Selected.Value
       )
    )
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

  • StephenGW Profile Picture
    583 on at
    Filter Gallery with Multiple Conditions avoid Delegation
    Ok, thank you for trying Warren.
  • WarrenBelz Profile Picture
    146,651 Most Valuable Professional on at
    Filter Gallery with Multiple Conditions avoid Delegation
    I will post this without further comment
  • StephenGW Profile Picture
    583 on at
    Filter Gallery with Multiple Conditions avoid Delegation
    Warren,
     
    I'm sorry for the repeated amateur mistakes. I went back to your original code and verified I have it correct now. It is still giving me rows with blank dates even when a start and end date is selected. Also the CB does not seem to be doing anything to the filter no matter if it is blank or selected.
  • WarrenBelz Profile Picture
    146,651 Most Valuable Professional on at
    Filter Gallery with Multiple Conditions avoid Delegation
    You still have the <> the wrong way - you need less than < not greater than >

  • StephenGW Profile Picture
    583 on at
    Filter Gallery with Multiple Conditions avoid Delegation
    I should have that fixed but as you can see I am still getting blanks in my gallery and Date of Maintenance should never be blank.
     
  • WarrenBelz Profile Picture
    146,651 Most Valuable Professional on at
    Filter Gallery with Multiple Conditions avoid Delegation
    You have greater than > instead of less than < on the date picker criteria (you had it correct the first time). < 1 is either Blank or it can be the zero day date that is sometimes there.
  • StephenGW Profile Picture
    583 on at
    Filter Gallery with Multiple Conditions avoid Delegation
    Oh shoot! Ok I fixed that, and it does not appear to be filtering the way I need. It should never show anything in the gallery where 'Date of Maintenance' is blank, and it is showing many. That is the constant I need. Anything with a blank in 'Date of Maintenance' should always be filtered out and that is not happening. Also, it appears that when I choose something in the DatePickers and the CB it is not adding that filter. If I select a date in DatePicker1 it should filter to only things >= that date and it is showing blanks. When I select a date in DatePicker1_1 it should only include dates <= that date. If both are selected, then it should be equal to or in between the dates. If neither are selected it should show everything that is not blank in 'Date of Maintenance'. If CB is blank, it should show everything meeting the Date criteria and when something is selected in the CB is should only show things meeting that criteria. As always, I appreciate your time to respond.

    Gallery Items:
    Filter(
       'Tube Mill Data',
       (
          Value(DatePicker1.SelectedDate) > 1 ||
          'Date of Maintenance' >= DatePicker1.SelectedDate
       ) &&
       (
          Value(DatePicker1_1.SelectedDate) > 1 ||
          'Date of Maintenance' >= DatePicker1_1.SelectedDate
       ) &&
       (
          Len(ComboBox1.Selected.Value) = 0 ||
          'Maintenance Performed' = ComboBox1.Selected.Value
       )
    )


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard