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

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (27,458)