cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
seadude
Level 10

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
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
Community Support Team
Community Support Team

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.
seadude
Level 10

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?

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

seadude
Level 10

Re: DELEGATION: Workaround?

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

Take care!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 306 members 5,739 guests
Please welcome our newest community members: