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 o...
Power Apps
Answered

Filter gallery based on multiple rows from another gallery

(0) ShareShare
ReportReport
Posted on by

Hi all,

 

in my work I'm trying to filter Gallery 1 based on the value on a column of gallery 2

 

Gallery 2 is selected as follow "Search('leadlist',TextInput2.Text,"client")" and it show all the rows of a SP List where the column Lead Number is duplicated according to the number of product sold.

 

Gallery 1 must follow these rules.

- if textinput2 is empty must show all the elements of the collection defined through a "Groupby", otherwise it must filter the same collection on the column "Lead Number" based on the output on the column Lead Number. 

 

If(TextInput2.Text = "",AddColumns(GroupBy(collectionLead,"Leadnumber" , "Data"),Filter(AddColumns(GroupBy(collectionLead,"Leadnumber" , "Data"),Leadnumber=Text(Gallery1.Selected.'Lead number')))

 

Currently if I use this formula it shows me only the first result and not all the results

Categories:
I have the same question (0)
  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Sesese

    Could you please share a sample data related to your data source with me?

    Do you want to filter Gallery1 based on Gallery2 as the following rules?

    1). filter based on a Lead Number grouped collection if the Text input 2 is blank

    2). filter based on a Lead Number grouped collection and Lead Number selected from the Gallery2

     

    If my understanding is correct, please try the following formula:

    If(
     IsBlank(TextInput19.Text),
     GroupBy(
     collectionLead,
     "Score",//Here is your 'Lead Number' column 
     "Data"
     ),
     Filter(
     GroupBy(
     collectionLead,
     "Score",//Here is your 'Lead Number' column 
     "Data"
     ),
     Score = Gallery26.Selected.Score //Here is your 'Lead Number' column 
     )
    )

    vqiaqimsft_0-1653621064353.png

     

    Have you found that if you apply the same grouped collection to the Gallery1, it will always display a single record because you use the GroupBy() function to distinct the LeadNumber column value, you could find the difference between the two galleries, Gallery 2 display two records with the duplicated Score value(like Lead Number in your scenario), However Gallery 1 display the distinct value by combining with different rows from a column.

     

  • Sesese Profile Picture
    on at

    Thank you for your answer.

     

    My issue here is that, filling the text box I can find 1 or multiple results on gallery 1. With these results I filter gallery 2 but in this case I can find only the first matching value between the two galleries

  • v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Sesese
    Sorry, but your words make the issue much more confusing.

    Could you please just check my description and respond if there is anything wrong with my understanding?

     

    In my scenario, The Search() function is used to filter the Gallery2, and then you filter Gallery1 based on the Gallery2 records, right?

    And I have clarified that the GroupBy() function does grouped the records with the duplicated LeadNumber value, so it will always return one record with the same LeadNumber, however you could see different fields values in this grouped record.

     

  • Sesese Profile Picture
    on at

    Ok I try to explain it better.

    This is the Gallery 1 structure

     

    Gallery1.png

    With the Text input box I search for the Product Code in order to identify the releated LeadNumber.

    The second Gallery is like this one

    Gallery2.png

     

     

    So typing on the textbox for example "A1" I want to idenitify on gallery2 the leadnumbers n. 1, 2, 5, 6

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @Sesese,

    Here is the thing, the If statement you set returns table with same data structure. So as I mentioned before, you could get two grouped table using the following formula

    If(IsBlank(TextInput19.Text),GroupBy(collectionLead,"ProductCode","Data"),Filter(GroupBy(collectionLead,"ProductCode","Data"),ProductCode=Gallery26.Selected.ProductCode))

    vqiaqimsft_0-1653899573843.png

    This grouped table will get you a single record including a nested table where exist complete Product Code 1,2,5,6.

     

    Not sure if this is what you want to achieve because we could only display like this if you insist on using the GroupBy() function.

     

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 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 181 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 112 Super User 2026 Season 2

Last 30 days Overall leaderboard