cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alexaristide
Helper I
Helper I

Count Rows in an SP list does not work

Hello,
I am trying to count all the records on my SP list (this is working but with a warning message)..., I also need to count all the records with a certain text value, but it does not work
the command line  I am using is:

CountRows(Filter(SPList1Collection;Clasificacion="A"))

or

CountRows(Filter(Ingresos;Clasificacion="A"))

 

it does not work any way

1 ACCEPTED SOLUTION

Accepted Solutions

@alexaristide 
Perfect, thanks for letting me know the error type 🙂

 

I'm going to take an educated guess here... is Clasificacion a Choices type in your SharePoint List.  If yes, you must refer to it as Clasificacion.Value in the Filter like this.

 

CountRows(Filter(SPList1Collection;Clasificacion.Value="A"))

 

If not, please take a screenshot of the error in the formula bar and let me know what type of SharePoint column Clasificacion is.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

7 REPLIES 7
mdevaney
Super User III
Super User III

@alexaristide 
Please explain what you mean by "it does not work".  What specifically is not working?  Are you receiving any errors or warning?

GarethPrisk
Super User II
Super User II

That warning is a delegation issue.

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

 

Only some things are delegable. Unfortunately, CountRows is not delegable. If your SharePoint list is less than 2000 rows, then you can ignore the warning, and your results should be accurate.

 

Otherwise, if it has more than (or could have more than) 2000 rows, then you can consider Collecting the rows. Local collections are not subject to delegation issues. https://powerusers.microsoft.com/t5/Building-Power-Apps/ClearCollect-for-more-than-2000-records/td-p...

 

timl
Super User III
Super User III

Hi @alexaristide 

The CountRows function is not delegable so this is the reason why you don't get the expected results.

@PaulD1   has posted a workaround here that involves returning the number of rows in a list by using the Rest API.

https://powerusers.microsoft.com/t5/Building-Power-Apps/Breaking-Delegation-limits-CountRows-with-Sh... 

https://sharepoint.stackexchange.com/questions/231870/how-to-get-listitem-counts-via-rest-api 

eka24
Super User III
Super User III

How many rows do you have in the list. If it is more that 2000, you will face delegation warning.

If it is less than 2000, go to File-advanced settings. Increase the delegation limit to 2000.

 

A work around if its still persist is to create a collection OnVisible of the screen:
ClearCollect(MyList,SPList1Collection)

 

Then

CountRows(Filter(MyList;Clasificacion="A"))

 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

@eka24while I agree changing the app settings to allow up to 2000 records will increase the limit, we must be clear that both CountRows() and Collect() are subject to the same limits. If they are concerned with the record limit, the Collect approach only works if you are collecting the records in a batch pattern to avoid the limit.

I already did it, 

I get the error message: "invalid argument type"

 

@alexaristide 
Perfect, thanks for letting me know the error type 🙂

 

I'm going to take an educated guess here... is Clasificacion a Choices type in your SharePoint List.  If yes, you must refer to it as Clasificacion.Value in the Filter like this.

 

CountRows(Filter(SPList1Collection;Clasificacion.Value="A"))

 

If not, please take a screenshot of the error in the formula bar and let me know what type of SharePoint column Clasificacion is.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (31,244)