Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Unanswered

How to filter distinct records in a gallery in a gallery

(1) ShareShare
ReportReport
Posted on by 53

Hey all,


I have three dataverse tables, Location and Issues, Country

 

Location 

countryID (lookup)          townID (lookup)     titleID (lookup)

1                                       45                                 20

1                                       46                                 21

1                                       47                                 22

2                                       48                                 23

2                                       49                                 24

3                                       50                                 25

3                                       51                                 26

 

CountryDetails

countryID                            description 

1                                       Text description 1

2                                       Text description 2

3                                       Text description 3

 

Town details

townID      issues

45              Text for issue 1

46.             Text for issue 2

47.             Text for issue 2

48.             Text for issue 3

49              Text for issue 4

 

I am trying to display a gallery in a gallery by using the Location table as the data source.  I am trying to show the distinct description in the first gallery and in the second gallery, when a user selects a description, the second gallery shows this issues by filtering the countryID.  The gallery show look like

 

description            Text for issue 

                              Text for issue 

description            Text for issue 

                              Text for issue

                              Text for issue

                              Text for issue

description            Text for issue

 

my code for the items in the second gallery is 

 

Filter(

       Location

             townID = gal_one.Selected.Value

      )

 

Any suggestions on where I am going wrong would be really helpful.

 

thank you for helping.

      

  • anandm08 Profile Picture
    1,936 Super User 2025 Season 1 on at
    Re: How to filter distinct records in a gallery in a gallery

    hi @GreenFrog ,

    To achieve the desired layout for your galleries, where you have a list of descriptions in the first gallery and the corresponding issues in the second gallery based on the selected description, follow these steps:

    1. First Gallery (gal_one) Setup:

      • Set the Items property of the first gallery (gal_one) to show distinct descriptions from the CountryDetails table.

     

    Distinct(CountryDetails, description)

     

     

    Second Gallery (gal_two) Setup:

    • Set the Items property of the second gallery (gal_two) to filter issues based on the selected description from the first gallery. You will need to use the Location, CountryDetails, and TownDetails tables to achieve this.

      Here’s how you can structure the formula for the Items property of the second gallery:

     

    Filter(
     AddColumns(
     Location,
     "countryDescription",
     Lookup(CountryDetails, countryID = Location.countryID).description,
     "townIssues",
     Lookup(TownDetails, townID = Location.townID).issues
     ),
     countryDescription = gal_one.Selected.Result
    ).townIssues

     

  • AmínAA Profile Picture
    1,105 Super User 2025 Season 1 on at
    Re: How to filter distinct records in a gallery in a gallery

    Greetings!

     

    I don't seem to have fully grasped what you are trying to achieve there . . . Can you show some images of what you're working in? Also, just in case, I have thought on something that may work for the code you displayed up there. . .

    Filter(
     Location
     townID = gal_one.Selected.Value
     ).'YOUR COLUMN NAME'

     

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 1