cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
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."

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

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

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

Helpful resources

Announcements
News & Announcements

Community Blog

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

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (11,678)