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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter collection by v...
Power Apps
Unanswered

Filter collection by values of another collection.

(1) ShareShare
ReportReport
Posted on by 156

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.

Categories:
I have the same question (0)
  • Verified answer
    yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    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!
  • AdamD Profile Picture
    156 on at

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

  • Jojie Profile Picture
    6 on at
    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 Profile Picture
    932 on at

    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!

  • Community Power Platform Member Profile Picture
    on at

    "in" is not delegable

  • BenDonahue Profile Picture
    932 on at

    In a recent update, "in" became delegable.

  • Kirk T Profile Picture
    9 on at

    Anyone know how to do the "Not In" and still delegable? I want to get a collection where show all table1 exclude records from table2, so in the original example I want only Value1, Value4. 

     

    I tried Filter(table1, Not(Column1 in table2)) but got delegation issue.

  • VolkanEmre Profile Picture
    5 on at

    Did you find a Solution for that? I'm looking for the same

  • jut Profile Picture
    6 on at

    KirkT and VolkanEmre,

     

    Found a solution that works for a reverse filter of a collection. (i.e. remove entries in a collection based on entries from another).

     

     

    ClearCollect(
    	colReverseFilter,
    	ForAll(colToKeep.Value,
    		If(Value in colToRemove.Value,"",Value)
    	)
    );
    RemoveIf(colReverseFilter,Value="")

     

     

    First block creates the reverse filter collection by searching through the collection/list I want to keep with the collection/list I don't want. Entries that are true, are then changed to 'blank' entries.

    The second block then removes any 'blank' entries from the collection.

     

    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

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard