cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Super User
Super User

DELEGATION: Workaround?

Anyone got a quick tip for getting around the delegation warning thrown here?

CountRows(
    Filter(
        '[dbo].[myTable]',
        createdDate <= ThisItem.date
    )
)

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: DELEGATION: Workaround?

Hi @seadude,

I always rise to a challenge.  One way to do it is to somehow get all of the results into a collection.  The problem here is that Collect and ClearCollect are also not delegated so you would have to split your Filter function so that it only collected <2k records at a time.  As an example, suppose you are collecting data over several years and that each year you never collect over 2k records.  

Concurrent( ClearCollect(yr2016, Filter('[dbo].[myTable]', Year(createdDate) = Year(Now()-2),
ClearCollect(yr2017, Filter( '[dbo].[myTable]',Year(createdDate) = Year(Now())-1),
ClearCollect(yr2018, Filter( '[dbo].[myTable]', Year(createdDate) = Year(Now())); Collect(allyears,yr2016);Collect(allyears,year2017);Collect(allyears,year2018)

CountRows(allyears) should give an accurate count all of your records. You could also CountRows on each subcollection ie CountRows(yr2017) and be sure that none of the rows is >2000.  Then sum the CountRows label values. 

View solution in original post

4 REPLIES 4
Highlighted
Community Support
Community Support

Re: DELEGATION: Workaround?

Hi @seadude,

 

Accourding to documentation:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-overview

Counting functions such as CountRowsCountA, and Count can't be delegated.

 

I have found an idea submitted asks for this feature, the status of this idea is planned. Please vote here:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/Extend-delegation-to-Sum-and-CountRows/idi-p/231...

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Super User
Super User

Re: DELEGATION: Workaround?

Thanks for the response @v-monli-msft, I'll vote on the idea.

What about @Drrickryp? You have suggested some great delegation work arounds in the past. Do you know a way to get a count of a filtered range without hitting the limits?

Highlighted
Super User
Super User

Re: DELEGATION: Workaround?

Hi @seadude,

I always rise to a challenge.  One way to do it is to somehow get all of the results into a collection.  The problem here is that Collect and ClearCollect are also not delegated so you would have to split your Filter function so that it only collected <2k records at a time.  As an example, suppose you are collecting data over several years and that each year you never collect over 2k records.  

Concurrent( ClearCollect(yr2016, Filter('[dbo].[myTable]', Year(createdDate) = Year(Now()-2),
ClearCollect(yr2017, Filter( '[dbo].[myTable]',Year(createdDate) = Year(Now())-1),
ClearCollect(yr2018, Filter( '[dbo].[myTable]', Year(createdDate) = Year(Now())); Collect(allyears,yr2016);Collect(allyears,year2017);Collect(allyears,year2018)

CountRows(allyears) should give an accurate count all of your records. You could also CountRows on each subcollection ie CountRows(yr2017) and be sure that none of the rows is >2000.  Then sum the CountRows label values. 

View solution in original post

Highlighted
Super User
Super User

Re: DELEGATION: Workaround?

Thanks @Drrickryp. I will work at carving up the data into smaller chunks using Collections.

Take care!

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (8,346)