cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AdamD
Helper III
Helper III

Filter collection by values of another collection.

I have two, single column tables from two different sources that I'd like to compare and filter the first table based on whether the values are present in any record of the second table in the different source collection. Example:

Table1
----------
Value1
Value2
Value4
Value5

 

Table2
---------
Value2
Value3
Value5


I would then like Table1 to be filtered to look like

Table1
--------
Value2
Value5


I'm trying to avoid creating a new table in this scenario, which has complicated things a bit. I specifically need to filter the original table, since I'm trying to filter the default items of a combobox and it seems to be very particular about the Items table being the same source as the DefaultSelectedItems table.

1 ACCEPTED SOLUTION

Accepted Solutions
yashag2255
Dual Super User II
Dual Super User II

Hi @AdamD 

 

you can try using the below expression:
Filter(Table1,Column1 in Table2.Column2).Column1
Here Table1 is my first table and Column1 is the name of its column, Same for Table2, it has a column named Column2.
 
The result will be the values from table1 that exist in Table 2MicrosoftTeams-image (90).png

 

Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

4 REPLIES 4
yashag2255
Dual Super User II
Dual Super User II

Hi @AdamD 

 

you can try using the below expression:
Filter(Table1,Column1 in Table2.Column2).Column1
Here Table1 is my first table and Column1 is the name of its column, Same for Table2, it has a column named Column2.
 
The result will be the values from table1 that exist in Table 2MicrosoftTeams-image (90).png

 

Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Amazing how much time I've burned away searching for that simple, elegant solution. Thank you! @yashag2255 

Jojie
New Member

This thread helps me to get the formula to not insert a record in the collection if it's already exist.  1. Clear and Collect in Collection ClearCollect( Collection1, AzureAD.GetGroupMembers("AzureADGroupObjectID#1").value ); 2. Collect and Do not Collect a record if existing in the collection  Collect( Collection1, (Filter(AzureAD.GetGroupMembers("AzureADGroupObjectID#2").value, Not(mail in Collection1.mail))) ); I hope this helps someone looking the same scenario I have. 🙂 
BenDonahue
Skilled Sharer
Skilled Sharer

I used this formula to filter a data table from a lookup table. I put this in the OnVisible of the screen:

 

ClearCollect(colQuestionsList,(Filter(CCAQuestions, QGroupKey in Filter(CCAChartQGroup, ChartKey = varRecord.ChartKey).QGroupKey)))

 

I then put 

Filter(colQuestionsList, QGroupKey = varQGroupRecord.QGroupKey)

in the Items property of the gallery, where varQGroupRecord is set by the user through another gallery on the same screen.

That gallery's Items is set to :

Filter(CCAChartQGroup, ChartKey = varRecord.ChartKey)

Works beautifully!

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Microsoft Ignite 768x460.png

Find your focus

Explore the latest tools,training sessions,technical expertise, networking and more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,543)