Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Suggested answer

Filtering a nested gallery based on child gallery content

(1) ShareShare
ReportReport
Posted on by 57
Hi, I have a nested gallery with the parent gallery being projects and the child gallery being all the trials associated with that project. The projects data uses the sharepoint generated ID column and the trials data has a lookup column called 'Project ID' which links the two datasets together. I currently have some filters that can be used on the gallery however i'd like to add a year filter. Year is a Choice column in the trials dataset only (childgallery). How would I go about adding this filter into the gallery? I have tried to use copilot to help but i keep getting the same error of ID is not recognised. I have included my current gallery items code for the parent gallery, Any help on this is much appreciated.
If(
  IsBlank(Ownerfilter.Selected.Value) && IsBlank(projectnamefilter.Selected.Value) && IsBlank(BUfilter.Selected.Value) && IsBlank(brandfilter.Selected.Value) && (IsBlank(categoryfilter.Selected.Value) || categoryfilter.Selected.Value = "All"),
  'MPT Tracker Projects',
  IsBlank(Ownerfilter.Selected.Value) && IsBlank(projectnamefilter.Selected.Value) && IsBlank(BUfilter.Selected.Value) && IsBlank(brandfilter.Selected.Value) && !IsBlank(categoryfilter.Selected.Value) && categoryfilter.Selected.Value <> "All",
  Filter('MPT Tracker Projects', 'Category'.Value = categoryfilter.Selected.Value),
  IsBlank(Ownerfilter.Selected.Value) && IsBlank(projectnamefilter.Selected.Value) && IsBlank(brandfilter.Selected.Value) && (IsBlank(categoryfilter.Selected.Value) || categoryfilter.Selected.Value = "All"),
  Filter('MPT Tracker Projects', 'BU'.Value = BUfilter.Selected.Value),
  IsBlank(Ownerfilter.Selected.Value) && IsBlank(BUfilter.Selected.Value) && IsBlank(brandfilter.Selected.Value) && (IsBlank(categoryfilter.Selected.Value) || categoryfilter.Selected.Value = "All"),
  Filter('MPT Tracker Projects', 'Project Name' = projectnamefilter.Selected.Value),
  IsBlank(projectnamefilter.Selected.Value) && IsBlank(BUfilter.Selected.Value) && IsBlank(brandfilter.Selected.Value) && (IsBlank(categoryfilter.Selected.Value) || categoryfilter.Selected.Value = "All"),
  Filter('MPT Tracker Projects', 'Owner Email' = Ownerfilter.Selected.Value),
  IsBlank(Ownerfilter.Selected.Value) && IsBlank(brandfilter.Selected.Value) && (IsBlank(categoryfilter.Selected.Value) || categoryfilter.Selected.Value = "All"),
  Filter('MPT Tracker Projects', 
    'Project Name' = projectnamefilter.Selected.Value && 
    'BU'.Value = BUfilter.Selected.Value
  ),
  IsBlank(projectnamefilter.Selected.Value) && IsBlank(brandfilter.Selected.Value) && (IsBlank(categoryfilter.Selected.Value) || categoryfilter.Selected.Value = "All"),
  Filter('MPT Tracker Projects', 
    'Owner Email' = Ownerfilter.Selected.Value && 
    'BU'.Value = BUfilter.Selected.Value
  ),
  IsBlank(BUfilter.Selected.Value) && IsBlank(brandfilter.Selected.Value) && (IsBlank(categoryfilter.Selected.Value) || categoryfilter.Selected.Value = "All"),
  Filter('MPT Tracker Projects', 
    'Owner Email' = Ownerfilter.Selected.Value && 
    'Project Name' = projectnamefilter.Selected.Value
  ),
  IsBlank(Ownerfilter.Selected.Value) && (IsBlank(categoryfilter.Selected.Value) || categoryfilter.Selected.Value = "All"),
  Filter('MPT Tracker Projects', 
    'Project Name' = projectnamefilter.Selected.Value && 
    'BU'.Value = BUfilter.Selected.Value && 
    'Brand'.Value = brandfilter.Selected.Value
  ),
  IsBlank(projectnamefilter.Selected.Value) && (IsBlank(categoryfilter.Selected.Value) || categoryfilter.Selected.Value = "All"),
  Filter('MPT Tracker Projects', 
    'Owner Email' = Ownerfilter.Selected.Value && 
    'BU'.Value = BUfilter.Selected.Value && 
    'Brand'.Value = brandfilter.Selected.Value
  ),
  IsBlank(BUfilter.Selected.Value) && (IsBlank(categoryfilter.Selected.Value) || categoryfilter.Selected.Value = "All"),
  Filter('MPT Tracker Projects', 
    'Owner Email' = Ownerfilter.Selected.Value && 
    'Project Name' = projectnamefilter.Selected.Value && 
    'Brand'.Value = brandfilter.Selected.Value
  ),
  IsBlank(brandfilter.Selected.Value) && (IsBlank(categoryfilter.Selected.Value) || categoryfilter.Selected.Value = "All"),
  Filter('MPT Tracker Projects', 
    'Owner Email' = Ownerfilter.Selected.Value && 
    'Project Name' = projectnamefilter.Selected.Value && 
    'BU'.Value = BUfilter.Selected.Value
  ),
  IsBlank(Ownerfilter.Selected.Value),
  Filter('MPT Tracker Projects', 
    'Project Name' = projectnamefilter.Selected.Value && 
    'BU'.Value = BUfilter.Selected.Value && 
    'Brand'.Value = brandfilter.Selected.Value && 
    (IsBlank(categoryfilter.Selected.Value) || categoryfilter.Selected.Value = "All" || 'Category'.Value = categoryfilter.Selected.Value)
  ),
  IsBlank(projectnamefilter.Selected.Value),
  Filter('MPT Tracker Projects', 
    'Owner Email' = Ownerfilter.Selected.Value && 
    'BU'.Value = BUfilter.Selected.Value && 
    'Brand'.Value = brandfilter.Selected.Value && 
    (IsBlank(categoryfilter.Selected.Value) || categoryfilter.Selected.Value = "All" || 'Category'.Value = categoryfilter.Selected.Value)
  ),
  IsBlank(BUfilter.Selected.Value),
  Filter('MPT Tracker Projects', 
    'Owner Email' = Ownerfilter.Selected.Value && 
    'Project Name' = projectnamefilter.Selected.Value && 
    'Brand'.Value = brandfilter.Selected.Value && 
    (IsBlank(categoryfilter.Selected.Value) || categoryfilter.Selected.Value = "All" || 'Category'.Value = categoryfilter.Selected.Value)
  ),
  IsBlank(brandfilter.Selected.Value),
  Filter('MPT Tracker Projects', 
    'Owner Email' = Ownerfilter.Selected.Value && 
    'Project Name' = projectnamefilter.Selected.Value && 
    'BU'.Value = BUfilter.Selected.Value && 
    (IsBlank(categoryfilter.Selected.Value) || categoryfilter.Selected.Value = "All" || 'Category'.Value = categoryfilter.Selected.Value)
  ),
  Filter('MPT Tracker Projects', 
    'Owner Email' = Ownerfilter.Selected.Value && 
    'Project Name' = projectnamefilter.Selected.Value && 
    'BU'.Value = BUfilter.Selected.Value && 
    'Brand'.Value = brandfilter.Selected.Value && 
    (IsBlank(categoryfilter.Selected.Value) || categoryfilter.Selected.Value = "All" || 'Category'.Value = categoryfilter.Selected.Value)
  )
)
 
Categories:
  • elhughes19 Profile Picture
    57 on at
    Filtering a nested gallery based on child gallery content
    I have tried both the suggestions given but neither have worked. I can filter the child gallery by year no problem however when I do this all the projects remain visible in the parent gallery rather than filtering to only the corresponding projects and trials. Copilot gives this formula when asked however even though .Id and .Value seem to work in a label they are 'not recognised' when input into the parent gallery items property
     
    If(
        IsBlank(yearfilter.Selected.Value),
        'MPT Tracker Projects',
        Filter(
            'MPT Tracker Projects',
            ID in Filter('MPT Tracker Trials', Year.Value = yearfilter.Selected.Value).'Project ID'.Id
        )
    )
    
     
     

     
  • Suggested answer
    Nandit Profile Picture
    1,563 Super User 2025 Season 1 on at
    Filtering a nested gallery based on child gallery content
     
    Is above the Items property of the Child Gallery?
    You can add a Combobox for Year on the screen and include the filter in the Child gallery. 
     
    Year Combobox Items:
    Choices([@DataSource].Year)
    Child Gallery Items:
    Filter(
        DataSource,
        true in ForAll(
            YearComboBox.SelectedItems,
            Value in Year.Value
        )
    )
     
    Hope this helps. 
     
    Kind regards,
    Nandit
     
    If this answers your query, please mark this response as the answer.
    If its helpful, please leave a like. Thanks!
  • Petar Hr. Profile Picture
    18 on at
    Filtering a nested gallery based on child gallery content
    Hi  elhughes19, 
     
    One this I can suggest from experience is that if you want to filter by a Choice column, you can treat the column as a "Data Source" via the Choices() function. 
     
    So, if I have a SharePoint list "My Projects", Choice column "Year" which have values "2024, 2025, 2026" and a Dropdown field that is used in the filter, I will try the below filter in my code: 
     
    Filter(
        Choices([@'My Projects'].'Year'),
        Value = 'Year Filter Field'.Selected.Value)
     
    I hope this helps! :)
     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,605 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,946 Most Valuable Professional

Leaderboard