web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Nested Filter on 2 tab...
Power Apps
Unanswered

Nested Filter on 2 table Dataverse

(1) ShareShare
ReportReport
Posted on by 17

Hi

 

I have created a small internal project management tool where I have a master table with all project and a table with sub task status. In power apps I would like a filter there is looking in both table and filter a gallery to only show the ongoing project and not startet projects.

Master Table

# ID

#Project name

 

Job Status

# ID

# Master Lookup

# Trade type (Choices field)

# Name

# project Status (Choice field, called Method/PA Status)

# Date

 

I tried this, but it doesn't seams to work.

Filter(Master, ID = ShowColumns(Filter('Job Status', 'Project Status' = 'Method/PA Status'.'On Going'), 'Master Lookup'))
 
Hope you can see where I want to go, but i cant figur this one out my self, and could not found any solution there fit what i want to do in this forum.
Categories:
I have the same question (0)
  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at
    Re: Nested Filter on 2 table Dataverse

    hi @Qlinox ,

    try this code:

    Filter(Master, ID in ShowColumns(Filter('Job Status', 'Project Status'.Value = "On Going"), 'Master Lookup'))
  • Qlinox Profile Picture
    17 on at
    Re: Nested Filter on 2 table Dataverse

    Hi @anandm08

     

    sorry for the delayed answer.

    I tried out your solution but it is the same

    It seems like it will not allow me to use nested filter in this way.

    If I test out this filter in a gallery like this it works: Filter('Job Status', 'Project Status' = 'Method/PA Status'.'On Going)

  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at
    Re: Nested Filter on 2 table Dataverse

    hi @Qlinox ,

    If using nested filters isn't working directly in Power Apps, we can take an alternative approach by creating a collection to hold the filtered IDs from the Job Status table and then use that collection to filter the Master table

    First, create the collection in the OnStart property of the app or in the OnVisible property of the screen where the gallery is located:

     

    ClearCollect(OngoingProjects, ShowColumns(Filter('Job Status', 'Project Status'.Value = "On Going"), 'Master Lookup'))

     

    Then, use this collection to filter the Master table in the gallery’s Items property:

     

    Filter(Master, ID in OngoingProjects)

     

    This approach avoids nested filters directly in the gallery's Items property and uses a collection to manage the filtered IDs instead.

     

  • Qlinox Profile Picture
    17 on at
    Re: Nested Filter on 2 table Dataverse

    Hi @anandm08 

     

    Thanks for your time, but i'm keeping running in to issue.
    It seems that Showcolumns on a related table doesn't seems to work, Im getting no result in my collection when ref the Master lookup.
    If I remove the showcollums I am getting the right result collected.

     

     

  • Verified answer
    Qlinox Profile Picture
    17 on at
    Re: Nested Filter on 2 table Dataverse

    Hi @anandm08 

     

    Update to my issue.

    I found a solution, it is not pretty but works.

     

    1. Create a formula column in my status table, there copied the Master ID from  table on the lookup column.

    2. Used a combobox to contain data from status table and sat the multi select to true.

    3. Sat the defaultitems with a Filter, there selected all found Onging and Not started jobs.

    4. Sat my gallery filter to compare the Master ID with selected items in the combobox on the formula master id column.
    This works and also give some flexibility where I can change the selected items in the combobox. 

     

    If there is anyone else there have a better method let me know 🙂

  • Kellboy2243 Profile Picture
    51 on at
    Re: Nested Filter on 2 table Dataverse

    Hi @Qlinox 

     

    Issue Summary:

    You need to filter a gallery in PowerApps to show only ongoing projects by combining data from two Dataverse tables: a Master table and a Job Status table. The goal is to display projects from the Master table that have a status of "On Going" in the Job Status table.

     

    Solution Steps:

    1. Identify Relationships:

      • Ensure that the Master Lookup in the Job Status table properly references the ID of the Master table.
    2. Use Nested Filters:

      • Filter the Job Status table to find entries with the "On Going" status.
      • Extract the Master Lookup values from the filtered Job Status entries.
      • Use these values to filter the Master table.

    Example Code:

    Here's how you can achieve this in PowerApps using nested Filter and LookUp functions:

    1. Filter the Job Status Table:

      • First, filter the Job Status table to find all entries with a status of "On Going".

     

    // Filter Job Status to get IDs of ongoing projects
    ClearCollect(
     OngoingProjects,
     Filter('Job Status', 'Project Status' = "On Going")
    )

     

     

        2. Filter the Master Table Using the Extracted IDs:

    • Use the collected OngoingProjects to filter the Master table.

     

    // Filter Master table based on IDs in OngoingProjects
    Filter(
     Master,
     ID in OngoingProjects.MasterLookup
    )

     

    Detailed Steps:

    1. Step 1: Filtering Job Status Table:

      • Use ClearCollect to create a collection of ongoing projects.

     

     

    ClearCollect(
     OngoingProjects,
     Filter('Job Status', 'Project Status' = "On Going")
    )

     

    Step 2: Filtering Master Table:

    • Use the OngoingProjects collection to filter the Master table.

     

    Filter(
     Master,
     ID in OngoingProjects.MasterLookup
    )

     

    Final Combined Code:

    You can put the combined logic directly in the Items property of the gallery that is supposed to show the ongoing projects:

     

    Filter(
     Master,
     ID in Filter('Job Status', 'Project Status' = "On Going').MasterLookup
    )

     

    Explanation:

    1. Filter('Job Status', 'Project Status' = "On Going"):

      • This filters the Job Status table to only include rows where the Project Status is "On Going".
    2. MasterLookup:

      • The MasterLookup contains the IDs from the Master table corresponding to the ongoing projects.
    3. Filter(Master, ID in ...):

      • This filters the Master table to include only the projects whose IDs are present in the filtered Job Status table.

    Additional Tips:

    • Ensure that your data connections are correctly set up in PowerApps.
    • Verify that the Master Lookup field in the Job Status table is correctly configured to reference the Master table's IDs.

    By following these steps, you should be able to filter your gallery to display only the ongoing projects from the Master table. Please mark this as a solution if this helps you resolve your query

  • Qlinox Profile Picture
    17 on at
    Re: Nested Filter on 2 table Dataverse

    Hi @Kellboy2243

     

    I tried your solution, but running in the same issue, as earlier that I am not allowed to go the full patch down in the lookup column, and therefore cannot select the Guid column.

    I tried this formula:

    Qlinox_0-1720423853704.png

    It seams that power apps do not like nested filters and you need some sort of handler in between where it can store the result.

     

    I found an working method I also shared, and think i will go with that one for now.

     

    Thanks for your input, it's definitely something I can use later.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard