PowerApps : Delegation Limit - cant filter on more than 2000 rows in a list

%3CLINGO-SUB%20id%3D%22lingo-sub-313615%22%20slang%3D%22en-US%22%3EPowerApps%20%3A%20Delegation%20Limit%20-%20cant%20filter%20on%20more%20than%202000%20rows%20in%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-313615%22%20slang%3D%22en-US%22%3E%3CP%3ECan%20anyone%20help%20please%3F!%20We%20have%20a%20look%20up%20on%20a%20data%20source%20in%20PowerApps%20that%20we%20are%20processing%20by%20delegation%20as%20the%20form%20is%20loading%20and%20cant%20filter%20on%20results%20due%20to%20the%20data%20source%20being%20above%202000%20rows%20from%20a%20SharePoint%20list.%20We've%20used%20this%20approach%20to%20get%20around%20a%20performance%20issue%20when%20using%20the%20app%2C%20but%20then%20this%20method%20has%20then%20struck%20us%20with%20the%20maximum%20amount%20of%20data%20that%20PowerApps%20can%20look%20at%20before%20then%20filtering%20based%20on%20our%20query.%20Desperately%20need%20a%20workaround%20for%20this%20please%3F!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20only%20'fudge'%20we%20have%20is%20to%20remove%20completed%20items%20from%20the%20list%20itself%2C%20but%20this%20defeats%20the%20object%20of%20the%20solution%20and%20having%20reportable%20data%20in%20one%20place.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3EJason.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-313615%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerApps%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-313697%22%20slang%3D%22en-US%22%3ERe%3A%20PowerApps%20%3A%20Delegation%20Limit%20-%20cant%20filter%20on%20more%20than%202000%20rows%20in%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-313697%22%20slang%3D%22en-US%22%3EYeah%20SharePoint%20makes%20it%20much%20harder%20due%20to%20the%20fact%20that%20you%20can't%20use%20the%20ID%20field%20direct%20for%20%26lt%3B%20or%20%26gt%3B%20in%20my%20example.%20What%20you%20might%20be%20able%20to%20try%20thou%20is%20creating%20another%20calculated%20column%20and%20just%20pull%20in%20the%20%5BID%5D%20which%20might%20be%20able%20to%20use%20%26gt%3B%20or%20%26lt%3B%20without%20delegation.%20You'll%20want%20to%20just%20manually%20setup%20a%20gallery%2C%20using%20a%20filter('data'%2Ccalcid%20%26gt%3B%202000)%20to%20test%20for%20delegation%2C%20if%20that%20works%20then%20you'll%20be%20able%20to%20use%20that%20method%2C%20if%20not%20and%20it%20delegates%20might%20have%20to%20see%20if%20there%20is%20some%20other%20way%20to%20rig%20it%20up.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-313681%22%20slang%3D%22en-US%22%3ERe%3A%20PowerApps%20%3A%20Delegation%20Limit%20-%20cant%20filter%20on%20more%20than%202000%20rows%20in%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-313681%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Chris%2C%3C%2FP%3E%3CP%3E%26nbsp%3BThanks%20for%20that%20fast%20response!%20We're%20calling%20in%20data%20from%20a%20SharePoint%20list%20-%20probably%20not%20optimal%2Fideal%2C%20but%20what%20we%20had%20to%20go%20with%20in%20the%20time%20available.%20I'm%20assuming%20this%20approach%20is%20still%20viable%3F%20We'll%20do%20some%20research%20into%20taking%20that%20approach%20if%20it%20is.%3C%2FP%3E%3CP%3EThanks%20again%2C%3C%2FP%3E%3CP%3EJason.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-313671%22%20slang%3D%22en-US%22%3ERe%3A%20PowerApps%20%3A%20Delegation%20Limit%20-%20cant%20filter%20on%20more%20than%202000%20rows%20in%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-313671%22%20slang%3D%22en-US%22%3EThe%20other%20issue%20you%20will%20run%20into%20is%20Max()%20is%20not%20delegate%20which%20is%20annoying%2C%20but%20depending%20on%20your%20source%2C%20if%20it's%20SQL%2C%20you%20can%20do%20a%20view%20in%20sql%20and%20have%20it%20calculate%20your%20max%20for%20you%20and%20reference%20that%20to%20set%20your%20variable.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-313668%22%20slang%3D%22en-US%22%3ERe%3A%20PowerApps%20%3A%20Delegation%20Limit%20-%20cant%20filter%20on%20more%20than%202000%20rows%20in%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-313668%22%20slang%3D%22en-US%22%3ESo%20the%202000%20records%20you're%20pulling%20in%2C%20what's%20that%20data%20look%20like%3F%20Is%20there%20a%20unique%20identifying%20in%20it%3F%20Also%20what%20is%20the%20data%20source.%20You%20can%20pull%20more%20than%202000%20records%2C%20you%20will%20just%20have%20to%20build%20a%20timer%20job%20to%20basically%20do%20it%20in%20batches%20into%20a%20collection.%20So%20do%202000%2C%20then%20do%20then%20next%202000%20etc.%20But%20you%20need%20a%20way%20to%20filter%20in%20batches%20of%20less%20than%202000%20so%20you%20would%20collect(yourcollection%2Cfilter('datasource'%2C%20id%20%26lt%3B%20variablenumber%20*%20%26amp%3B%26amp%3B%20id%20%26lt%3B%20previousvariablenumber))%3Bset(previousvariablenumber%2Cvariablenumber)%3Bset(variablenumber%2CVariablenumber%2B2000)%3CBR%20%2F%3E%3CBR%20%2F%3ESo%20basically%20you%20would%20find%20a%20way%20to%20connect%20this%20to%20a%20time%20job%20that%20runs%20up%20till%20your%20max%20records%2C%20so%20you%20need%20to%20calculate%20ahead%20of%20time%20how%20many%20times%20the%20timer%20runs%2C%20then%20for%20variable%20would%20be%20the%20chunk%20of%20records%20so%20start%20at%202000%2C%20then%20add%202000%20to%20it.%20and%20each%20time%20you%20run%20you%20get%20a%20back%20of%202000%20into%20your%20collection.%20So%20if%20you%20calculated%20you%20had%205000%20records%20you%20would%20get%20a%203%20to%20run%20the%20timer%20or%20loop%203%20times%2C%20first%20time%20you%20would%20get%200-2000%2C%202nd%202000-4000%203rd%20time%204000-5000.%20%3CBR%20%2F%3E%3CBR%20%2F%3EAnyway%2C%20that's%20high%20level%20how%20you%20could%20approach%20that%20but%20it%20should%20work%20%3A).%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2407324%22%20slang%3D%22en-US%22%3ERe%3A%20PowerApps%20%3A%20Delegation%20Limit%20-%20cant%20filter%20on%20more%20than%202000%20rows%20in%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2407324%22%20slang%3D%22en-US%22%3EHello%20Chris%2C%3CBR%20%2F%3EI%20have%20a%20SharePoint%20list%20having%20more%20than%2010000%20items.%20I%20had%20created%20a%20column%20FormattedInDate%20(Numeric)%20in%20that%20list.%20I%20had%20created%20Index%20on%20this%20column%20as%20primary%20and%20CreatedBy%20as%20secondary.%3CBR%20%2F%3EHowever%2C%20when%20I%20am%20trying%20to%20fetch%20all%20records%20in%20PowerApps%2C%20using%20Filter%2C%20it%20is%20returning%20only%20first%20500%20records.%20The%20command%20I%20am%20using%20is%3A-%3CBR%20%2F%3EClearCollect(ConsolidateData%2CFilter(DailyTaskSheetForPowerApps%2CFormattedInDate%20%26gt%3B%3D%2020000101%2C%20FormattedInDate%20%26lt%3B%3D%2020210602%2C'Created%20By'.Email%20%3D%20User().Email))%3B%3CBR%20%2F%3E%3CBR%20%2F%3EHere%20ConsolidateData%20is%20a%20collection%20created%20in%20SharePoint%20while%20DailyTaskSheetForPowerApps%20is%20the%20SharePoint%20list%20having%20more%20than%2010000%20items.%3CBR%20%2F%3EAdditionally%2C%20I%20am%20saving%20the%20CreatedDate%20in%20yyyyMMdd%20format%20so%20that%20I%20can%20make%20sorting%2Ffiltering%20on%20it.%3CBR%20%2F%3EPlease%20suggest%20what%20I%20am%20missing%20to%20get%20all%20records%20from%20SharePoint.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2408434%22%20slang%3D%22en-US%22%3ERe%3A%20PowerApps%20%3A%20Delegation%20Limit%20-%20cant%20filter%20on%20more%20than%202000%20rows%20in%20a%20list%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2408434%22%20slang%3D%22en-US%22%3EThis%20is%20normal.%20You%20can%20only%20ever%20return%20500%20(2000%20with%20setting%20changes)%20records%20in%20a%20query%20regardless%20of%20delegation.%20Delegation%20let%E2%80%99s%20you%20actually%20filter%20down%20those%20500%20records.%20If%20you%20use%20something%20not%20delegable%20you%20return%20the%20first%20500%20records%20in%20the%20days%20first%20then%20filter%20so%20you%20always%20get%20the%20same%20results%20regardless%20of%20the%20filter.%20%3CBR%20%2F%3E%3CBR%20%2F%3EThere%20are%20for%20loop%20hacks%20out%20there%20you%20can%20use%20to%20return%20more%20records%20by%20getting%20records%20filter%20by%20ID%20in%20500%20batches%20but%20you%20can%E2%80%99t%20just%20filter%20and%20get%20more%20than%20the%20max%20in%20a%20single%20query.%3C%2FLINGO-BODY%3E
Contributor

Can anyone help please?! We have a look up on a data source in PowerApps that we are processing by delegation as the form is loading and cant filter on results due to the data source being above 2000 rows from a SharePoint list. We've used this approach to get around a performance issue when using the app, but then this method has then struck us with the maximum amount of data that PowerApps can look at before then filtering based on our query. Desperately need a workaround for this please?!

 

The only 'fudge' we have is to remove completed items from the list itself, but this defeats the object of the solution and having reportable data in one place.

 

Thanks,

Jason.

6 Replies
So the 2000 records you're pulling in, what's that data look like? Is there a unique identifying in it? Also what is the data source. You can pull more than 2000 records, you will just have to build a timer job to basically do it in batches into a collection. So do 2000, then do then next 2000 etc. But you need a way to filter in batches of less than 2000 so you would collect(yourcollection,filter('datasource', id < variablenumber * && id < previousvariablenumber));set(previousvariablenumber,variablenumber);set(variablenumber,Variablenumber+2000)

So basically you would find a way to connect this to a time job that runs up till your max records, so you need to calculate ahead of time how many times the timer runs, then for variable would be the chunk of records so start at 2000, then add 2000 to it. and each time you run you get a back of 2000 into your collection. So if you calculated you had 5000 records you would get a 3 to run the timer or loop 3 times, first time you would get 0-2000, 2nd 2000-4000 3rd time 4000-5000.

Anyway, that's high level how you could approach that but it should work :).
The other issue you will run into is Max() is not delegate which is annoying, but depending on your source, if it's SQL, you can do a view in sql and have it calculate your max for you and reference that to set your variable.

Hi Chris,

 Thanks for that fast response! We're calling in data from a SharePoint list - probably not optimal/ideal, but what we had to go with in the time available. I'm assuming this approach is still viable? We'll do some research into taking that approach if it is.

Thanks again,

Jason.

Yeah SharePoint makes it much harder due to the fact that you can't use the ID field direct for < or > in my example. What you might be able to try thou is creating another calculated column and just pull in the [ID] which might be able to use > or < without delegation. You'll want to just manually setup a gallery, using a filter('data',calcid > 2000) to test for delegation, if that works then you'll be able to use that method, if not and it delegates might have to see if there is some other way to rig it up.
Hello Chris,
I have a SharePoint list having more than 10000 items. I had created a column FormattedInDate (Numeric) in that list. I had created Index on this column as primary and CreatedBy as secondary.
However, when I am trying to fetch all records in PowerApps, using Filter, it is returning only first 500 records. The command I am using is:-
ClearCollect(ConsolidateData,Filter(DailyTaskSheetForPowerApps,FormattedInDate >= 20000101, FormattedInDate <= 20210602,'Created By'.Email = User().Email));

Here ConsolidateData is a collection created in SharePoint while DailyTaskSheetForPowerApps is the SharePoint list having more than 10000 items.
Additionally, I am saving the CreatedDate in yyyyMMdd format so that I can make sorting/filtering on it.
Please suggest what I am missing to get all records from SharePoint.
This is normal. You can only ever return 500 (2000 with setting changes) records in a query regardless of delegation. Delegation let’s you actually filter down those 500 records. If you use something not delegable you return the first 500 records in the days first then filter so you always get the same results regardless of the filter.

There are for loop hacks out there you can use to return more records by getting records filter by ID in 500 batches but you can’t just filter and get more than the max in a single query.