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 / Filter Gallery Based b...
Power Apps
Answered

Filter Gallery Based by Data from Previous Gallery

(0) ShareShare
ReportReport
Posted on by 42

Hi Powerapps Community,

 

I have two gallery screens that I would like to nest. The first gallery ('UID Selection Gallery') shows the company names and then once clicked, I would like second gallery ('Gallery2') to show all the company's employee representatives. 

 

I currently have a distinct and filter by user function on the 'UID Selection Gallery' and the same filter by user function on the 'Gallery2'. These codes need to be included. 

UID Selection Gallery currently: 

 

Search(Distinct(Filter('VOC Customer List_ Test File Clean_V2',(AccountManagerEmail=varUserEmail|| sales_mgr_email=varUserEmail||sales_dir_email=varUserEmail||state_dir_email=varUserEmail)),Title&": "&reg_name),'UID Search Box'.Text,"Result")

 

Gallery2 currently: 

 

Filter('VOC Customer List_ Test File Clean_V2',(AccountManagerEmail=varUserEmail|| sales_mgr_email=varUserEmail||sales_dir_email=varUserEmail||state_dir_email=varUserEmail))

 

 

Data source: 'VOC Customer List_ Test File Clean_V2'

Gallery 1: UID Selection Gallery

Gallery 2: Gallery2

Column name required for filter: Title

 

Any help would be appreciated! error2.png

Categories:
  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @sarahmahony 

    I think I see the issue here.  Once you use Distinct() you lose the ability to filter on Title for your second gallery. There may be other ways to do this but I found that this one should work without the need for using Distinct().

     

    //First, filter your list and create a temporary table "fltrd"
    With( 
     {fltrd: Filter( 
     'VOC Customer List_ Test File Clean_V2',
     Or(AccountManagerEmail=varUserEmail,
     sales_mgr_email=varUserEmail,
     sales_dir_email=varUserEmail,
     state_dir_email=varUserEmail
     )
    //Then, add temp column and group on it to provide uniqueness without losing 
    // the rest of the data
    //Then, sort on the new temp column and ungroup the rest of the data
    //into a temporary table (tbl), that expose the Title in the gallery
     tbl: Ungroup( 
     Sort(
     GroupBy(
     AddColumns(
     fltrd,"tempcol",Concatenate(
     Title,": ", reg_name
     )
     ),
     "tempcol", "restofdata"
     ),
     grouper
     ),
     "restofdata"
     )
     },
    //Allows for the search of "tbl" with your Textbox. 
     Search(
     tbl,
     'UID Search Box'.Text,
     "Title"
     )
    )

     

    In your second gallery you can now reference Title to filter your list:

     

    Filter(
     VOC Customer List_ Test File Clean_V2', Title=Gallery1.Selected.Title,
     Or(
     AccountManagerEmail=varUserEmail,
     sales_mgr_email=varUserEmail,
     sales_dir_email=varUserEmail,state_dir_email=varUserEmail
     )
    )

    As perhaps a more elegant way of doing this, the exact same formula for Gallery1 could be used as the items property of a dropdown and Gallery2 could be Filtered on the dropdown instead of Gallery1.  This would take up much less real estate in your app.

     

  • sarahmahony Profile Picture
    42 on at

    @Drrickryp You're amazing! Thank you!

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 396 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 323

#3
WarrenBelz Profile Picture

WarrenBelz 193 Most Valuable Professional

Last 30 days Overall leaderboard