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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filtering a Sharepoint...
Power Apps
Unanswered

Filtering a Sharepoint list that has 2000+ records

(1) ShareShare
ReportReport
Posted on by 2
Hi all,
 
Pretty new to Power Apps so my knowledge is limited. I am trying to achieve something and I just can't seem to get it right.
 
A general overview of what I'm trying to do:
 
Bookings can be made that contain details about individual people. This is assigned to a BookingID. I want users to be able to view a previous booking and see a list of who is attributed to that booking. 

I need to pull in further detail about these people from a separate list in Sharepoint which has over 2000 rows. Whatever I try, it doesn't seem to work. I have changed the column / collection names because I want to keep it anonymous for the work I am doing.
 
This is the code for the button to view more details about who is in the booking:

// Creates a separate collection for each person, showing only BookingID and PersonID
 
ClearCollect(
    CurrentPeople,
    ShowColumns(
        Filter(
            'Booking People',
            BookingID in CurrentBooking.BookingID
        ),
        BookingID,
        PersonID
    )
);
 
// Creates a new collection appending the extra details onto the list of people
 
ClearCollect(
    CurrentPeople2,
    ShowColumns(
        Filter(
            'Person Details',
            PersonID in CurrentPeople.PersonID
        ),
        PersonID,
        Forename,
        Surname,
        DateOfBirth
 
    )
);
 
The CurrentPeople collection populates as expected.
 
CurrentPeople2 however is empty.

I have tried using a LookUp instead, but it only returns the first records from 'Person Details'. I have also tried using ForAll but it populates the collection with nested tables which is not what I want. 
 
If I explicitly state a PersonID in the second filter that I know exists in 'CurrentPeople', the filter works, which leads me to believe this is due to an issue with the 2000 row limit. 
 
I have also tried to extract all of the people from 'Person details' into a separate collection and performing the match there, but that only retrieves the first 2000 people. 
 
Am I approaching this in completely the wrong way?
Categories:
I have the same question (0)
  • tsa-svd2srv Profile Picture
    204 on at
    In the little free time I have, I'm trying to develop an answer for you. I hope to have it soon.
  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at
    The fundamental issue is that you are using the in Filter, which is not Delegable in SharePoint, so will only address the first 2,000 (maximum) records of the target list. One approach would be to address the newest 2,000 records - something like this
    With(
       {
          _Booking:
          Sort(
             CurrentBooking,
             ID,
             SortOrder.Descending
          ),
          _People:
          Sort(
             'Booking People',
             ID,
             SortOrder.Descending
          ),
          _Person:
          Sort(
             'Person Details',
             ID,
             SortOrder.Descending
          )
       },
       With(
          {
             _Current:
             ShowColumns(
                Filter(
                   _People,
                   BookingID in _Booking.BookingID
                ),
                BookingID,
                PersonID
             )
          },
          ClearCollect(
             CurrentPeople,
             ShowColumns(
                Filter(
                   _Person,
                   PersonID in _Current.PersonID
                ),
                PersonID,
                Forename,
                Surname,
                DateOfBirth
             )
          )
       )
    );
    or possibly do a big collection for the large list - this blog of mine shows how to collect lists up to 4,000 records. I also do not know in your post what CurrentBooking is. If it is a collection, you may have to apply the same treatment as the other two if it is over 2,000 records. If a collection under 2,000 records, you do not need the top part and can apply it directly where required.
    How many records are in 'Person Details' ?
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
    ​​​​​​​
  • tsa-svd2srv Profile Picture
    204 on at

    I believe a solution can be implemented with two Power Automate flows, structured as follows:

    Flow 1: Retrieve Distinct Event BookingIDs

    This flow collects the unique BookingIDs from your 'Booking People' list. For example:

    • Event-B001: 5 attendees
    • Event-B009: 3 attendees
    • Event-B041: 7 attendees

    The flow returns a list of distinct BookingIDs: B001, B009, and B041.

    Flow 2: Retrieve PersonIDs for Selected Event

    When an event is selected (e.g., Event-B009), this flow retrieves a list of PersonIDs associated with that event. For instance:

    • Event-B009 → PersonIDs: P023, P104, P009

    Implementation Outline

    1.Triggering the First Flow:

    • In my test environment, I used a button’s OnSelect property to trigger the first flow.
    • The returned event BookingIDs are stored in a collection (colBookingID) and used to populate a dropdown menu for selecting an event.
    • Alternatively, for better user experience, you could move this code to the screen’s OnVisible property, preloading the event data when the screen loads.

    2.Triggering the Second Flow:

    • Once an event is selected from the dropdown, its OnChange property triggers the second flow.
    • The second flow retrieves the associated PersonIDs and stores them in a collection (colBookingPeople).

    3.Displaying Data in a Gallery:

    • The gallery can be filtered using the colBookingPeople collection to display information about the attendees. Something like:
    AddColumns(
        RenameColumns(
                    colBookingPeople,
            PersonID,
            X_PersonID
        ),
        X_PersonDetails,
        LookUp(
            'Person Details',
            PersonID = X_PersonID
        )
    )

    Here is a ScreenShot of my test environment:

     
    • "noBookings" is the button to collect the BookingIDs, the "13" next to it is the number of uniques BookingIDs.
    • Then you see a dropdown to select one of the thirteen available bookings, in this case, "B007", which returned 15 people who attended that event with their information from a SharePoint List called 'Person Details'.
    • A gallery of the people who attended event "B007"
    • The "15" at the bottom is a count of the rows in the gallery.
    • Please keep in mind, I set the Data Row Limit in my test environment to "8", showing these collections go past the delegation limits.
    • The limitation now is from SharePoint at 100,000 records.
    I do want to warn you the second flow responds within a reasonable amount of time, usually a few seconds.
     
    But the first flow, has to go through many records to get its data, so it took somewhere between 40-60 seconds to return data.
     
    The first flow could be eliminated if there were a List of events, that maybe stored "BookingID", "EventName", "Facilitator", "Location", etc.. Then you could use that list without the first flow to get event attendees.
     

    Next Steps

    If Power Automate is an option for you, I can provide a more detailed step-by-step guide to implement this solution. Let me know how you’d like to proceed!

  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at
    A quick follow-up to see if you received the answer you were looking for or if you need further assistance.

    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   
  • JY-22010944-0 Profile Picture
    2 on at
    Hi all,
     
    Apologies for the delayed response. 
     
    Thanks for taking the time to post your solutions, it's very much appreciated. 
     
    Just wanted to add a note to say that a co-worker provided me a solution to this that achieves what I want it to. 
     
    As @WarrenBelz suggested, this was the issue I was facing:
     
    "The fundamental issue is that you are using the in Filter, which is not Delegable in SharePoint, so will only address the first 2,000 (maximum) records of the target list. One approach would be to address the newest 2,000 records - something like this"
     
    I resolved this by applying a lookup within the gallery I was displaying the details in, as opposed to the button that opened the gallery. 
     
    If someone comes across this and has a similar issue, please take the advice of the users in the previous replies, or drop me a message and I can try and explain further. 
     
    Thanks again for the support.
     
     
     
  • WarrenBelz Profile Picture
    153,026 Most Valuable Professional on at
    Depending on the number of items in the gallery, you need to watch the users total API count limit as each record is a separate query and it would be possible for them to be throttled if too many queries were made on the gallery.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard