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 / How to hide gallery ba...
Power Apps
Answered

How to hide gallery based on filter options

(1) ShareShare
ReportReport
Posted on by 39
Hi Hello,
 
I have 2 filter Options. Filter A and Filter B.
Filter A: has SharePoint columns names,
Filter B: has SharePoint columns values selected in Filter A.
 
Below is the code written on filter A
Filter A - items = [" ","AD Account", "OU Path"]
Filter B - items
If(
        drpFilterClause.Selected.Value = "AD Account",
        Distinct(
            'OU-Access-Info',
            'AD-Account'
        ),
 
Currently the Gallery items are loading when i select filter value in Filter A. 
But my requirement is it should display gallery items when i select any value in Filter B.
How to achieve? Any help.
 
And below is the code on Gallery Items:
 
 
If(
        drpFilterClause.Selected.Value = "AD Account",
        Filter(
            'OU-Access-Info',
            Substitute(
                comFilterOptions.Selected.Value,
                "Access",
                ""
            ) in 'AD-Account'
        ),
        If(
            drpFilterClause.Selected.Value = "OU Path",
            Filter(
                'OU-Access-Info',
                Substitute(
                    comFilterOptions.Selected.Value,
                    "Access",
                    ""
                ) in 'OU Path'
            ),
)
Categories:
  • Verified answer
    CU18061035-1 Profile Picture
    Microsoft Employee on at
    hey
     
     
    can u try this in filter B:
    If(
        drpFilterClause.Selected.Value = "AD Account",
        Distinct('OU-Access-Info', 'AD-Account'),
        drpFilterClause.Selected.Value = "OU Path",
        Distinct('OU-Access-Info', 'OU Path')
    )
    
    and this in the items property of the gallery:
    If(
        !IsBlank(drpFilterClause.Selected.Value) && !IsBlank(comFilterOptions.Selected.Value),
        Switch(
            drpFilterClause.Selected.Value,
            "AD Account",
            Filter(
                'OU-Access-Info',
                Substitute(comFilterOptions.Selected.Value, "Access", "") in 'AD-Account'
            ),
            "OU Path",
            Filter(
                'OU-Access-Info',
                Substitute(comFilterOptions.Selected.Value, "Access", "") in 'OU Path'
            )
        ),
        'OU-Access-Info' // Default - shows all items if no filters are selected
    )
    
    if my answer helped please mark as verified,
     
     
    thanks
  • Suggested answer
    CU28081555-1 Profile Picture
    39 on at
     
    Thanks a lot, for the below help with this my requirement is achievd. 
  • CU28081555-1 Profile Picture
    39 on at
    Hi Markus, 
     
    Need one more help on this. 
     
    OU-Access-Info is my SharePoint List, displaying the items in gallery and implementing the pagination, and filter.
    Individually both functions are working, but how to combine them. Could you please help. 
    Below is the pagination code:
     
    /*LastN(
        FirstN(
            'OU-Access-Info',
            varPage
        ),
        RoundDown(
            GalleryAdmin.Height / GalleryAdmin.TemplateHeight,
            0
        )
    )*/
    If(
        drpFilterClause.Selected.Value = "Primary Owner",
        Filter(
            'OU-Access-Info',
            Substitute(
                comFilterOptions.Selected.Value,
                "Access",
                ""
            ) in 'Primary Owner'.DisplayName
        ),
        If(
            drpFilterClause.Selected.Value = "AD Account",
            Filter(
                'OU-Access-Info',
                Substitute(
                    comFilterOptions.Selected.Value,
                    "Access",
                    ""
                ) in 'AD-Account'
            ),
            If(
                drpFilterClause.Selected.Value = "OU Path",
                Filter(
                    'OU-Access-Info',
                    Substitute(
                        comFilterOptions.Selected.Value,
                        "Access",
                        ""
                    ) in 'OU Path'
                ),
                If(
                    drpFilterClause.Selected.Value = "Secondary Owner",
                    Filter(
                        'OU-Access-Info',
                        Substitute(
                            comFilterOptions.Selected.Value,
                            "Access",
                            ""
                        ) in 'Secondary Owner'.DisplayName
                    ),
                    If(
                        drpFilterClause.Selected.Value = "Reason for Access",
                        Filter(
                            'OU-Access-Info',
                            Substitute(
                                comFilterOptions.Selected.Value,
                                "Access",
                                ""
                            ) in 'Reason for Access'.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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 190 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard