Showing results for 
Search instead for 
Did you mean: 
Advocate V
Advocate V

Filtering data from multiple tables

Can we filter SQL table based on the values from another table(like a join in SQL)?


We have two tables Table1_UserPermission["PersonID","ProjectID","IsActive"], Table2_ProjectDetails["ProjectID","ProjectName","ProjectCost"].


When the user logs in, we are trying to check the Table1_UserPermission table first for the active projects using the PersonID. Then project details data from Table2_ProjectDetails will be displayed in a gallery for the user active projects from Table1_UserPermission.

Kudo Kingpin
Kudo Kingpin

Hi @DileepGolla

I would normally produce local collections of the active projects for the current user in Table1, and then use that to filter the list of projects in Table2.

Something like:

ClearCollect(colUserPermissions, Filter(Table1_UserPermission, PersonID=currentUserID && IsActive=true));
ClearCollect(colUserProjects, Filter(Table2_ProjectDetails, ProjectID in colUserPermissions.ProjectID))

The variable 'currentUserID' is from however you determine what the current user's ID number is.

colUserProjects becomes your Gallery.Items source.

Hope this helps.


Hi Hadyn,


Thank you for taking out time and responding to my question.


I have tried the approach you have suggested but it gives a delagating warning when I try to use "in" operator.


Even if I ignore the delagation warning, the collection is empty. Are you facing the same issue? Or am I missing something obvious?

A few things to check:

  • Is the currentUserID set to a valid ID number? (One that has 'active' projects in Table1)
  • Is there data in the colUserPermissions collection?



HI Hadyn,


Yes I can see the data collected in the first collection and also there is data in all the required columns in both the tables.




Hmmmm, not sure on that one.  It may be a delegation issue.

Alternatively, since you are using SQL, a stored procedure could return the results you need.  I often do this for more complicated queries with lots of joins or where there are thousands of records to filter from.


A step-by-step guide by @Mr-Dang-MSFT is available here:



Community Support
Community Support

Hi @DileepGolla,

Could you please share a bit more about the data structure of your two SQL tables?

Is the IsActive column a Bit type column in your Table1_UserPermission table?

Further, have you faced a Delegation Warning issue with the in operator within your formula?

I have made a test on my side, please take a try with the following workaround:

Set the OnVisible property of the first screen of your app to following:

ClearCollect(UserPermissionCollection, Filter(Table1_UserPermission, PersonID = currentUserPersonID, IsActive = true))

Set the Items property of the Gallery to following:

Filter(Table2_ProjectDetails, ProjectID in UserPermissionCollection.ProjectID)

then check if the issue is solved.


In addition, the in operator could be delegated within SQL table data source, please check the following article for more details:

please share more details about the Delegation warning issue within your app.

As an alternative solution, in order to get rid of the Delegation warning issue, please consider take a try with the following workaround:

Set the OnVisible property of the first screen of your app to following:

ClearCollect(UserPermissionCollection, Filter(Table1_UserPermission, PersonID = currentUserPersonID, IsActive = true));
ClearCollect(ProjectDetailsCollection, Table2_ProjectDetails)

Set the Items property of the Gallery to following:

Filter(ProjectDetailsCollection, ProjectID in UserPermissionCollection.ProjectID)

 Also please check if your Table2_ProjectDetails table contains the ProjectID column, and have prorper records for current user with specific ProjectID Value.


In addition, 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Not applicable

Thanks for creating this thread @DileepGolla. Can you review the latest replies and advise if they answer your question or if you need more assistance?


Thank you,



Helpful resources

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (2,119)