cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

Filter collection based on presence of similar item in another collection

Hi All

I have 2 collections from 2 SP lists with same columns and I need Collection1 to have only items that are not present in Collection2.

Anybody knows how this can be done?

Thanks 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper IV
Helper IV

Re: Filter collection based on presence of similar item in another collection

Thanks for your suggestions guys, but I think I found better way to do it:

 

ForAll(Collection1, 
  If(  Column1 > 0 , 
       RemoveIf(Collection2, Column1=Collection1[@Column1])
     )
);

Let me know what you think

View solution in original post

4 REPLIES 4
Highlighted
Super User III
Super User III

Re: Filter collection based on presence of similar item in another collection

@RomanKorchak 

You must loop through Collection1 using FORALL to check if each record exists in Collection2 with the help of the LOOKUP functon.  My assumptions are Collection1 initially has all of the records stored within it and we are seeking to remove any duplicates.  I also assume your collection has only a single column called your_column.

 

ClearCollect(
    Collection1,    
    ForAll(    
        Collection1,
        If(
           IsBlank(LookUp(Collection2, your_column_2, Collection1[your_column_1])),
           {your_column_1: your_column_1}
        )
    )
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Helper IV
Helper IV

Re: Filter collection based on presence of similar item in another collection

Both lists/collections have a lots of same columns 

Highlighted
Community Support
Community Support

Re: Filter collection based on presence of similar item in another collection

Hi @RomanKorchak ,

 

In addition to what @mdevaney  has suggested, if your collections' columns are more than 1, please first use below formula to create a new collection with only one column:

ClearCollect(Collection3,Distinct(Collection2, NEWCOLUMN))

 

Then use this Collection3 to loop through Collection1.

 

Regards,

Mona

 

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper IV
Helper IV

Re: Filter collection based on presence of similar item in another collection

Thanks for your suggestions guys, but I think I found better way to do it:

 

ForAll(Collection1, 
  If(  Column1 > 0 , 
       RemoveIf(Collection2, Column1=Collection1[@Column1])
     )
);

Let me know what you think

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Come join us today! Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,119)