web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Gallery filter - multi...
Power Apps
Suggested Answer

Gallery filter - multiple criteria

(0) ShareShare
ReportReport
Posted on by 119
Dear Community,
 
I have an app with data source SharePoint list called "List".
 
On the app screen I have 4 criteria, based of which the gallery should be filtered, however the filtering based on combination of multiple criteria does not work (there is no error, it just does not filter based on the selected criteria):
 
Toggle1 Show all items
Combo Box DataCardValue26 (Group) 
TextInput_City_1 City
TextInput_PostCode Postal Code
 
How it should work:
If toggle (saying "show all items") is ON, do not filter based on User e-mail. If toggle is OFF - filter only items where the current user is in column "User". Then in the next step filter based on the combination of the other criteria - city, postal code and Combo Box chosen value (Group).
 
The Items property of the gallery contains this formula. Could you please help me to correct the formula?
 
If(
    Toggle1.Value = false,
    If(
        !IsBlank(DataCardValue26.Selected.Value) && TextInput_City_1.Text <> "" && TextInput_PostCode.Text <> "",
        Filter(
            Filter(
                'List',
                'User E-mail_not visible_1'.Text = 'User'.Email
            ),
            DataCardValue26.Selected.Value = 'Group'.Value && TextInput_City_1.Text = City && TextInput_PostCode.Text = 'Postal Code'
        ),
         If(
                !IsBlank(DataCardValue26.Selected.Value) && TextInput_City_1.Text <> "" && TextInput_PostCode.Text = "",
                Filter(
                    Filter(
                        'List',
                        'User E-mail_not visible_1'.Text = 'User'.Email
                    ),
                 DataCardValue26.Selected.Value = 'Group'.Value && TextInput_City_1.Text = City 
                ),
            If(
                !IsBlank(DataCardValue26.Selected.Value) && TextInput_City_1.Text = "" && TextInput_PostCode.Text <> "",
                Filter(
                    Filter(
                        'List',
                        'User E-mail_not visible_1'.Text = 'User'.Email
                    ),
                 DataCardValue26.Selected.Value = 'Group'.Value && TextInput_PostCode.Text = 'Postal Code' 
                ),
            If(
            !IsBlank(DataCardValue26.Selected.Value) && TextInput_City_1.Text = "" && TextInput_PostCode.Text ="",
            Filter(
                Filter(
                    'List',
                    'User E-mail_not visible_1'.Text = 'User'.Email
                ),
                DataCardValue26.Selected.Value = 'Group'.Value
            ),
            If(
                IsBlank(DataCardValue26.Selected.Value) && TextInput_City_1.Text <> "" && TextInput_PostCode.Text <> "",
                Filter(
                    Filter(
                        'List',
                        'User E-mail_not visible_1'.Text = 'User'.Email
                    ),
                   TextInput_City_1.Text = City &&  TextInput_PostCode.Text = 'Postal Code'
                ),
                If(
                IsBlank(DataCardValue26.Selected.Value) && TextInput_City_1.Text <> "" && TextInput_PostCode.Text ="",
                Filter(
                    Filter(
                        'List',
                        'User E-mail_not visible_1'.Text = 'User'.Email
                    ),
                    TextInput_City_1.Text = City
                ),
            If(
                IsBlank(DataCardValue26.Selected.Value) && TextInput_City_1.Text = "" && TextInput_PostCode.Text <>"",
                Filter(
                    Filter(
                        'List',
                        'User E-mail_not visible_1'.Text = 'User'.Email
                    ),
                    TextInput_PostCode.Text = 'Postal Code'
                ),
            
            
           
                Filter(
                    'List',
                    'User E-mail_not visible_1'.Text = 'User'.Email
                )
            )
        )
    ))))),
    If(
        !IsBlank(DataCardValue26.Selected.Value) && TextInput_City_1.Text <> "" && TextInput_PostCode.Text <> "",
        Filter(
            'List',
            DataCardValue26.Selected.Value = 'Group'.Value && TextInput_City_1.Text = City && TextInput_PostCode.Text = 'Postal Code'
        ),
        If(
            !IsBlank(DataCardValue26.Selected.Value) && TextInput_City_1.Text <> "" && TextInput_PostCode = "",
                Filter(
                    'List',
                    DataCardValue26.Selected.Value = 'Group'.Value && TextInput_City_1.Text = City
                ),
        If(
                !IsBlank(DataCardValue26.Selected.Value) && TextInput_City_1.Text = "" && TextInput_PostCode <> "",
                Filter(
                    'List',
                    DataCardValue26.Selected.Value = 'Group'.Value && TextInput_PostCode.Text = 'Postal Code'
                ),
        If(
            !IsBlank(DataCardValue26.Selected.Value) && TextInput_City_1.Text = "" && TextInput_PostCode.Text = "",
            Filter(
                'List',
                DataCardValue26.Selected.Value = 'Group'.Value
            ),
            If(
                IsBlank(DataCardValue26.Selected.Value) && TextInput_City_1.Text <> "" && TextInput_PostCode <> "",
                Filter(
                    'List',
                    TextInput_City_1.Text = City && TextInput_PostCode.Text = 'Postal Code'
                ),
            If(
                IsBlank(DataCardValue26.Selected.Value) && TextInput_City_1.Text <> "" && TextInput_PostCode = "",
                Filter(
                    'List',
                    TextInput_City_1.Text = City
                ),
            If(
                IsBlank(DataCardValue26.Selected.Value) && TextInput_City_1.Text = "" && TextInput_PostCode <> "",
                Filter(
                    'List',
                    TextInput_PostCode.Text = 'Postal Code'
                ),      
            
                'List'
            )
        )
    )
)))))
 
Thank you in advance.
Categories:
I have the same question (0)
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,968 Super User 2026 Season 2 on at
    Hi,
     
    No way thats gonna make my eyes bleed.
     
    What you need to do, is manually take all of these Filters.
    Do them 1 by 1 to make sure that data is returned.
     
    Then add a button and in the OnSelect, add your filters 1 by 1 until it stops doing what you expect.
     
    Then you will find that a filter is bad, or they are not grouped properly by (  and )
     
    Since you have not given us data to look at, there is no way to tell you why your filters don't show the correct data. It looks fine to me but i have no idea
    what you are trying to do against what data.
     
  • Suggested answer
    WarrenBelz Profile Picture
    156,432 Most Valuable Professional on at
    You do not need all that code for five possible filter results,
    Filter(
       'List',
       Toggle1.Value ||
       (
          'User E-mail_not visible_1'.Text = 'User'.Email &&
          (
             Len(DataCardValue26.Selected.Value) = 0 ||
             DataCardValue26.Selected.Value = 'Group'.Value
          ) &&
          (
             Len(TextInput_PostCode.Text) = 0 ||
             TextInput_PostCode.Text = 'Postal Code' 
          ) &&
          (
             Len(TextInput_City_1.Text) = 0 ||
             TextInput_City_1.Text = City 
          )
       )
    )
     
    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
  • Eeyore2005 Profile Picture
    119 on at
    Dear @WarrenBelz,
     
    I tried to shorten my code by using the one you suggested, but unfortunately I got a lot of error messages.
    However I found some mistakes in my own long code, corrected them and now all the combinations of the filtering criteria seem to work correctly.
     
    Thank you anyway and have a nice day.
  • WarrenBelz Profile Picture
    156,432 Most Valuable Professional on at
    I am not getting notifications, so did not see your response.
    The code I posted is valid based on your initial post. You might take a moment to look at the logic - it will save you a lot of time in the future.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard