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 a Gallery or Da...
Power Apps
Unanswered

Filter a Gallery or Data Table based on values in another Gallery/Data Table

(0) ShareShare
ReportReport
Posted on by 35

Hi

I have constructed a PowerApp which works with data from two SharePoint lists. One of the lists holds the 'central' record/item. In the app, I've set up a screen where the end user can add one or more 'month' values to the central record - the 'month' values are stored in the second SP list (which I'm considering as the 'child' list). The link between the central record and the month values in the child list is via the ID - see below for screenshots of the two SP lists:

 

Main (central) list

tomburton2023_0-1699873505673.png

 

'Child' list (holding the month values)

 

tomburton2023_1-1699873544239.png

 

In a screen of the Power App, I want users to be able to see a list of 'Current items/records', this can be either a Gallery or Data Table. By 'current item', it should show any records in the current year (there's a field for 'Year' in the central list which we can filter on), and also any records where there is at least one month value for the current month (ie November for right now).

 

I can't work out how to do this using one Gallery/Data Table. I've set up one Data Table on the screen as below - this gets me the list of records pertaining to the current month from the child list:

 

tomburton2023_2-1699873733412.png

For the above Data Table, I'm using this as the Items parameter: 

 

Filter('Corporate WIP System - Month values', Text(Today(), "mmmm")in Month)

 

I've added a second Data Table, and can get it to work with the currently selected item:

 

tomburton2023_3-1699873803691.png

By using this code: 

 

Filter('Corporate WIP System test',Year(Today()) in 'Fiscal Year'.Value && DataTable3.Selected.Title in ID)

 

However, I want the second Data Table to show all items, not just the item that links to the selected one in the first Data Table. I cannot figure out how to do this. I've tried the same concept with a Gallery and can't get it to work.

 

I wonder if the Collections feature could be part of an answer, but I can't figure out how to go about doing it. Any help/advice would be much appreciated.

  

 

Categories:
I have the same question (0)
  • M_Ali_SZ365 Profile Picture
    1,110 on at

    Hi @tomburton2023 ,

    Create a Collection:
    On the screen's OnVisible property, use the Collect function to create a collection of month values from the child list for the current year.

    Collect(
    MonthlyValuesCollection,
    Filter(
    'Corporate WIP System - Month values',
    Year(Date) = Year(Today()) && Text(Date, "mmmm") = Text(Today(), "mmmm")
    )
    )

    Use the Collection to Filter the Main Data:
    Set the Items property of your Gallery or Data Table to filter the main data based on the values in the collection.

    Filter(
    'Corporate WIP System test',
    Year(Today()) = 'Fiscal Year'.Value &&
    DataTable3.Selected.Title in ID &&
    ID in MonthlyValuesCollection.ID
    )

    Replace 'Fiscal Year'.Value, DataTable3.Selected.Title, ID, and MonthlyValuesCollection.ID with the actual column names.

    Fuel our success! 🚀 Give a thumbs up and click 'Solution Accepted' to supercharge our community. Your actions speak volumes!
    Warm regards,
    Muhammad Ali

  • tomburton2023 Profile Picture
    35 on at

    Hi @M_Ali_SZ365 

    Thanks so much for your response.

    When I add the Collection code in the screen's 'OnVisible' property, I see the following:
    tomburton2023_0-1699952636641.png

    When I hover over the red error cross, it says that there is an 'Incorrect format specifier for 'Text''.

    Also, from a logic perspective, I don't have a 'year' or 'date' field in the child Month list - there is just the Month, so I'm not sure how that would work. The reason for not having this is that the user might add month values for the next fiscal year (forecasted values), so the Year field resides in the main list (for the main records).

     

    Thanks, Tom

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,074

#2
Valantis Profile Picture

Valantis 639

#3
11manish Profile Picture

11manish 606

Last 30 days Overall leaderboard