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

How can I filter one collection of SharePoint items to show items NOT in another collection of SharePoint items?

I have two collections containing SharePoint list data. I want to show items in a gallery from Collection A that do NOT exist in Collection B, and I want to do this by comparing emails from a SharePoint Person column.
Here's the example:

Collection A:

Person
Table
Table

Collection B:

DatePerson
7/2/2020Table
7/2/2020Table

Since the "tables" are from SharePoint, this is a sample of what they contain:

DisplayNameEmail
Joe Smithjsmith@email.com

I figured I'd do something like this in the Gallery's Items property, but this obviously doesn't work:

Filter(CollectionB,Not(CollectionB.Person.Email in CollectionA.Person.Email))
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Hi @pwrappr01 :

Please check the following two situations:

Case1:If the person fileds in collectionA and collectionB are all table type,Please try this code:

 

Filter(CollectionB,!(First(Person).Email in Ungroup(CollectionA,"Person").Email))

 

Case2:If the person fileds in collectionA is  table type but the person fileds in collectionB is  record type ,Please try this code:

 

Filter(CollectionB,!(Person.Email in Ungroup(CollectionA,"Person").Email))

 

Best Regards,

Bof

 

View solution in original post

4 REPLIES 4
Highlighted
Super User III
Super User III

@pwrappr01 
Your formula is very close to the solution.  Here's how I would write it 🙂

Filter(CollectionA, !(Person.Email in CollectionB.Person.Email))



---
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

@mdevaney, thanks for the response. I tried this, but the CollectionB.Person.Email throws an error ("Name isn't recognized") when used in conjunction with the in operator for some reason. It works everywhere else in the app when invoked.

Highlighted
Community Support
Community Support

Hi @pwrappr01 :

Please check the following two situations:

Case1:If the person fileds in collectionA and collectionB are all table type,Please try this code:

 

Filter(CollectionB,!(First(Person).Email in Ungroup(CollectionA,"Person").Email))

 

Case2:If the person fileds in collectionA is  table type but the person fileds in collectionB is  record type ,Please try this code:

 

Filter(CollectionB,!(Person.Email in Ungroup(CollectionA,"Person").Email))

 

Best Regards,

Bof

 

View solution in original post

Highlighted

@v-bofeng-msft, Case #2 worked like a charm. Thank you much, and thank you, @mdevaney, for posting to assist.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (12,876)