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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Trying to compare 2 Ga...
Power Apps
Unanswered

Trying to compare 2 Galleries (Lists) and find missing data

(0) ShareShare
ReportReport
Posted on by 380

I have 2 Sharepoint lists called MeterReadings and Auths and there is a common field called auth in both lists

I want to create a Gallery that will show records from MeterReadings where the auth is Not in the Auths list

 

Delegation is a problem as both lists have > 2000 records in them, also the auth field in Meter Readings sometimes has multiple auths like this: 01234K;23456L;45678P. so I will need to use the In function to compare I think

any help much appreciated as always...

Categories:
  • WarrenBelz Profile Picture
    156,926 Most Valuable Professional on at

    Hi @bobgodin ,

    In simplistic terms if you had only a single value in the field, it would look something like this

    Filter(
     MeterReadings,
     !(Auth in Auths.Auth)
    )

    but this would not be delegable on two fronts - the Not() ! and in statements. Not only do you have a Data Row Limit issue, but also a multi-value delimited field that needs to be queried in a more complex way. My thoughts firstly if the newest 2,000 records on both list will do the job - you need to "add in the missing fields" at the bottom after the GroupBy as your major issue with the Not filter is you will have duplicates of each of the records that are not in the delimited field (this would be much easier if that was a simple single value text field)

    With(
     {
     _Readings: 
     Sort(
     MeterReadings,
     ID,
     SortOrder.Descending
     ),
     _Auths: 
     Sort(
     Auths,
     ID,
     SortOrder.Descending
     )
     },
     AddColumns(
     GroupBy(
     Ungroup(
     ForAll(
     _Auths,
     Filter(
     _Readings As _Read,
     !(Auth in _Read.Auth)
     )
     ),
     "Value"
     ),
     "ID",
     "Data"
     ),
     "Auth",
     First(Data).Auth,
    	 "NextField",
     First(Data).NextField 
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • bobgodin Profile Picture
    380 on at

    Hi @WarrenBelz thank you for the prompt response

    I copied and pasted your code (with a minor change to Auth - it's auth lowercase) and half of the code looks good but the 2nd half there is an error - see attached screenshot

    thanks

     

    code.png
  • WarrenBelz Profile Picture
    156,926 Most Valuable Professional on at

    @bobgodin ,

    What is the error ? I made a couple of collections here with the same names as your lists (out of some test lists) and renamed some fields the same as yours - it ran as below with no errors and produced the expected result. I am assuming that both auth fields are Single Lines of Text

    WarrenBelz_0-1707190825427.png

     

  • bobgodin Profile Picture
    380 on at

    Hi @WarrenBelz - it's on "Client" - it says AddColumns has some invalid arguments, expected operator......

     

    the word Client redline is heavier than the rest of the code...

  • WarrenBelz Profile Picture
    156,926 Most Valuable Professional on at

    @bobgodin ,

    Are you sure clientname is the correct name for the field you are adding and that was the original field name ? Nothing else makes sense presently.

  • bobgodin Profile Picture
    380 on at

    @WarrenBelz - the problem was the double quotes around Client were the wrong kind - I got an error unexpected character U+201c but when I replaced the double quotes and the red line went away it crashed my session and it keeps doing this....I'll try a new screen..

  • bobgodin Profile Picture
    380 on at

    @WarrenBelz a new screen and Gallery didn't help - I get the racing ants at the top of the screen and thewn after a couple of minutes bam - it crashes my browser:

    bobgodin_0-1707194162947.png

     

  • WarrenBelz Profile Picture
    156,926 Most Valuable Professional on at

    @bobgodin ,

    It works perfectly here with a couple of collections with the same names and fields, however this is a very complex filter, which is exacerbated by your delimited text column and the need to check each value in each field. I am not totally convinced you will get the right result now - you will have to test it when it gets working. Instead of the With() Statements, make a couple of collections with the same data and then filter them and see if that works.

  • bobgodin Profile Picture
    380 on at

    @WarrenBelz I made 2 collections which have given me the latest 2000 records from each List and took out the With statement and it still crashes - is there something else I can try?

  • bobgodin Profile Picture
    380 on at

    @WarrenBelz I tried changing my datarow limit to 500 and the query ran without crashing but came up with 500 missing records so not sure it has worked...tomorrow is another day?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 194 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 150

Last 30 days Overall leaderboard