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 not wor...
Power Apps
Suggested Answer

Gallery filter not working fine when additional filters added based on combobox

(1) ShareShare
ReportReport
Posted on by 156
I have a Gallery filter which is showing records based on combobox selections. If i select combobox value as My Request/Boss View, it displays fine. Below code works fine.
 
Gallery Items
With(
    {
        _activerequests: SortByColumns(
            Filter(
                'Users',
                (Len('ETypeCB'.Selected.Value) = 0 || 'Employee Type'.Value = ETypeCB.Selected.Value) && (Len('LocationCB'.Selected.Name) = 0 || Location.Value = LocationCB.Selected.Name) && (Len(SwitchCB.Selected.Value) = 0 || (SwitchCB.Selected.Value = "My Request" && AdUser.Email = User().Email) || (SwitchCB.Selected.Value = "Boss View" && (Manager.Email = User().Email ))) && (StartsWith(
                    'First Name',
                    SearchBox.Text
                ) || StartsWith(
                    'Last Name',
                    SearchBox.Text
                ) || StartsWith(
                    Company,
                    SearchBox.Text
                ))
            ),
            "Modified",
            SortOrder.Descending
        )
    },
    SortByColumns(
        _activerequests,
        varsortcolumn,
        varsortdirection
    )
)
 
However i tried to add a new option called "Clearance View" in combobox. Below is the code for the same which i tried to add in the Gallery Items property. But this throws error. May i know why? Group Members is a multiselect person or Group field. 
 
Gallery Items property Filter code for Clearance View
SwitchCB.Selected.Value = "Clearance View" && User().Email in Filter(
                    Groups,
                    LookUp(
                        Locations,
                        Location = ThisRecord.Location,
                        'Provisioning Group'.Value
                    ) = 'Group Name' && 'Group Type'.Value = "Provisioning").'Group Members'.Email
 
 
I have the same question (0)
  • Suggested answer
    Valantis Profile Picture
    7,236 Super User 2026 Season 2 on at
     
    The error is because you can't nest a Filter() inside another Filter() condition directly in Power Apps with SharePoint. The nested Filter on Groups with a LookUp inside it is also non-delegable and can't be evaluated inline as a condition.
     
    fix inside the With() block before the main Filter runs:
     
    With(
     {
     _activerequests: ..., // your existing code
     _userHasClearance: !IsEmpty(
     Filter(
     Groups,
     'Group Type'.Value = "Provisioning" &&
     'Group Name'.Value = LookUp(Locations, Location = User().Location, 'Provisioning Group'.Value) &&
     'Group Members'.Email = User().Email
     )
     )
     },
     // then add to your existing conditions:
     SwitchCB.Selected.Value = "Clearance View" && _userHasClearance
    )
     
    Pre-computing _userHasClearance outside the main Filter means it evaluates once as a boolean, which Power Apps can handle in the condition without the nested Filter error.
     
    Note: the LookUp(Locations, Location = User().Location...) assumes you have a way to get the current user's location. Adjust that lookup to match how you get the user's location in your app.
     
      Best regards,

    Valantis   ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/
    💼 LinkedIn   ▶️ YouTube
  • Suggested answer
    11manish Profile Picture
    4,376 Super User 2026 Season 2 on at
    First fix the record-scope problem using As U and As G. Then validate the Clearance View condition independently. After that, check delegation warnings if these tables contain more than a few hundred/thousand records.
     
    Try below:
    SwitchCB.Selected.Value = "Clearance View" &&
    CountIf(
        Filter(
            Groups As G,
            LookUp(
                Locations,
                Location = U.Location,
                'Provisioning Group'.Value
            ) = G.'Group Name'
            &&
            G.'Group Type'.Value = "Provisioning"
            &&
            !IsBlank(
                LookUp(
                    G.'Group Members',
                    Email = User().Email
                )
            )
        ),
        true
    ) > 0
     
  • Poweruser32490 Profile Picture
    156 on at
     
    I tried your suggestion but still the code throws error. May i know why?
     
    With(
        {
            _userHasClearance: !IsEmpty(
                Filter(
                    Groups,
                    'Group Type'.Value = "Provisioning" && 'Group Name' = LookUp(
                        Locations,
                        Location = ThisRecord.Location,
                        'Provisioning Group'.Value
                    ) && 'Group Members'.Email = User().Email
                )
            ),
            _activerequests: SortByColumns(
                Filter(
                    'Users',
                    (Len('ETypeCB'.Selected.Value) = 0 || 'Employee Type'.Value = ETypeCB.Selected.Value) && (Len('LocationCB'.Selected.Name) = 0 || Location.Value = LocationCB.Selected.Name) && (Len(SwitchCB.Selected.Value) = 0 || (SwitchCB.Selected.Value = "My Badge Request" && AdUser.Email = User().Email) || SwitchCB.Selected.Value = "All" || (SwitchCB.Selected.Value = "My Badge Request" && AdUser.Email = User().Email) || (SwitchCB.Selected.Value = "Manager and Delegate View" && (Manager.Email = User().Email || Delegate.Email = User().Email)) || SwitchCB.Selected.Value = "Provisioning Team" &&_userHasClearance|| (SwitchCB.Selected.Value = "Manager and Delegate View" && (Manager.Email = User().Email || Delegate.Email = User().Email))) && (StartsWith(
                        'First Name',
                        SearchBox.Text
                    ) || StartsWith(
                        'Last Name',
                        SearchBox.Text
                    ) || StartsWith(
                        Company,
                        SearchBox.Text
                    ))
                ),
                "Modified",
                SortOrder.Descending
            )
        },
        SortByColumns(
            _activerequests,
            varsortcolumn,
            varsortdirection
        )
    )
     
  • Suggested answer
    Haque Profile Picture
    4,088 Super User 2026 Season 2 on at
    It seems that the filter condition for SwitchCB.Selected.Valueis overly complex and contains repeated or conflicting checks, which can cause logical errors or unexpected behavior. Specifically:
    • You have repeated conditions for "My Badge Request" and "Manager and Delegate View" .
    • The "All" option is included but does not have a proper filter logic to show all relevant records.
    • The logical grouping and parentheses are not clear, which can cause incorrect evaluation.
     
     
    Here is a clean and corrected version of the filter logic of SwitchCB.Selected.Value part:
    (
        SwitchCB.Selected.Value = "All" && (
            AdUser.Email = User().Email || 
            Manager.Email = User().Email || 
            Delegate.Email = User().Email || 
            _userHasClearance
        )
    ) || 
    (
        SwitchCB.Selected.Value = "My Badge Request" && 
        AdUser.Email = User().Email
    ) || 
    (
        SwitchCB.Selected.Value = "Manager and Delegate View" && 
        (Manager.Email = User().Email || Delegate.Email = User().Email)
    ) || 
    (
        SwitchCB.Selected.Value = "Provisioning Team" && 
        _userHasClearance
    )
    
     
    Here is the full corrected code snippet:
     
    With(
        {
            _userHasClearance: !IsEmpty(
                Filter(
                    Groups,
                    'Group Type'.Value = "Provisioning" && 
                    'Group Name' = LookUp(
                        Locations,
                        Location = ThisRecord.Location,
                        'Provisioning Group'.Value
                    ) && 
                    'Group Members'.Email = User().Email
                )
            ),
            _activerequests: SortByColumns(
                Filter(
                    'Users',
                    (Len('ETypeCB'.Selected.Value) = 0 || 'Employee Type'.Value = ETypeCB.Selected.Value) &&
                    (Len('LocationCB'.Selected.Name) = 0 || Location.Value = LocationCB.Selected.Name) &&
                    (
                        (SwitchCB.Selected.Value = "All" && (
                            AdUser.Email = User().Email || 
                            Manager.Email = User().Email || 
                            Delegate.Email = User().Email || 
                            _userHasClearance
                        )) ||
                        (SwitchCB.Selected.Value = "My Badge Request" && AdUser.Email = User().Email) ||
                        (SwitchCB.Selected.Value = "Manager and Delegate View" && (Manager.Email = User().Email || Delegate.Email = User().Email)) ||
                        (SwitchCB.Selected.Value = "Provisioning Team" && _userHasClearance)
                    ) &&
                    (
                        StartsWith('First Name', SearchBox.Text) ||
                        StartsWith('Last Name', SearchBox.Text) ||
                        StartsWith(Company, SearchBox.Text)
                    )
                ),
                "Modified",
                SortOrder.Descending
            )
        },
        SortByColumns(
            _activerequests,
            varsortcolumn,
            varsortdirection
        )
    )
    
     
     
     
     
  • WarrenBelz Profile Picture
    156,474 Most Valuable Professional on at
    I will add this option assuming you want to add that filter to your existing code - the part you added in non-delegable on many levels, so need to be added to the bottom "locally" processed code.
    With(
       {
          _activerequests: 
          SortByColumns(
             Filter(
                'Users',
                (
                   Len('ETypeCB'.Selected.Value) = 0 || 
                   'Employee Type'.Value = ETypeCB.Selected.Value
                ) && 
                (
                   Len('LocationCB'.Selected.Name) = 0 || 
                   Location.Value = LocationCB.Selected.Name
                ) && 
                (
                   Len(SwitchCB.Selected.Value) = 0 || 
                   (
                      SwitchCB.Selected.Value = "My Request" && 
                      AdUser.Email = User().Email
                   ) || 
                   (
                      SwitchCB.Selected.Value = "Boss View" && 
                      (
                         Manager.Email = User().Email 
                      )
                   )
                ) && 
                (
                   StartsWith(
                      'First Name',
                      SearchBox.Text
                   ) || 
                   StartsWith(
                      'Last Name',
                      SearchBox.Text
                   ) || 
                   StartsWith(
                      Company,
                      SearchBox.Text
                   )
                )
             ),
             "Modified",
             SortOrder.Descending
          )
       },
       SortByColumns(
          Filter(
             _activerequests,
             SwitchCB.Selected.Value = "Clearance View" && 
             User().Email in 
             Filter(
                Groups,
                LookUp(
                   Locations,
                   Location = ThisRecord.Location
                ).'Provisioning Group'.Value = 'Group Name' && 
                'Group Type'.Value = "Provisioning"
             ).'Group Members'.Email
          ),
          varsortcolumn,
          varsortdirection
       )
    )
     
    Please 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 answering Yes to Was this reply helpful? or give it a Like
    Visit my blog
    Practical Power Apps    LinkedIn  

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
11manish Profile Picture

11manish 317 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 305 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 266

Last 30 days Overall leaderboard