cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Count Items in Sharepoint List

Hi,

 

I am trying to figure out if it's possible to count the number of items in 2 sharepoint list.

 

Scenario:

 

I have SPLIst1 and SPLIst2 , both list have status (i.e. submitted, in progress, etc.). Is it possible to count the total number of items with a particular status on both list?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @Anonymous,

I agree with @Anonymous's thought almost. Please take a try with the following formula:

CountRows(Filter(SPList1, Status="submitted")) + CountRows(Filter(SPList2, Status="submitted"))

Note: Above formula may cause Delegation issue, you could consider take a try to save your SPLIst1 and SPList2 into two separated Collections, and then use the Collection as data source within your formula.

In order to avoid the Delegation warning issue, please take a try with the following workaround:

Set the OnVisible property of the first screen of your app to following:

ClearCollect(SPList1Collection, SPList1);
ClearCollect(SPList2Collection, SPList2)

Modify your formula as below:

CountRows(Filter(SPList1Collection, Status="submitted")) + CountRows(Filter(SPList2Collection, Status="submitted"))

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
KickingApps
Skilled Sharer
Skilled Sharer

Short answer, yes.  You might try:  

CountRows(
Filter(
SPListName, 
Status = "Submitted")

Do keep in mind, you may run into delegation issues using the above.  If you collect the records and do the same on the collection, you should not have an issues.

 

Anonymous
Not applicable

Or use CountIF functions

 

But first get your DataBase to a collection because this functions used directly on a SP List is going to have Delegation Issues...

Anonymous
Not applicable

@KickingApps thank you for that, however I need to count the total number of ticket with submitted status on both list.

Anonymous
Not applicable

@Anonymous I have 2 different sharepoint list and I need to count the total number of a particular status on both list.

Anonymous
Not applicable

OK, so only sum the CountIF functions

 

Countif( first_datasource, condition) + Countif( second_datasource, condition)

 

 

v-xida-msft
Community Support
Community Support

Hi @Anonymous,

I agree with @Anonymous's thought almost. Please take a try with the following formula:

CountRows(Filter(SPList1, Status="submitted")) + CountRows(Filter(SPList2, Status="submitted"))

Note: Above formula may cause Delegation issue, you could consider take a try to save your SPLIst1 and SPList2 into two separated Collections, and then use the Collection as data source within your formula.

In order to avoid the Delegation warning issue, please take a try with the following workaround:

Set the OnVisible property of the first screen of your app to following:

ClearCollect(SPList1Collection, SPList1);
ClearCollect(SPList2Collection, SPList2)

Modify your formula as below:

CountRows(Filter(SPList1Collection, Status="submitted")) + CountRows(Filter(SPList2Collection, Status="submitted"))

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

andypi
Frequent Visitor

Trying to do the same thing here. 

Closest I have got is using 

https://<tenant>.sharepoint.com/sites/<mysubsite>/_vti_bin/ListData.svc/<ListName>/$count?$filter=<ChoiceField>/Value eq %27Pending%27 and AssignedToId eq <PowerApps.Office365(User()).ID >

The idea being I can display this value as a Label to the user every time the user changes that field value on the page. 

Yet when I look to add this as a

Set(varName, <above response>)

I am now going to need to use power automate and pass bunch of authentication just to get a simple value. Where <above response would be 

PowerAutomateCallFromPowerApp(uri).Run

Seems like a lot of workaround to use PowerApps? but maybe I am close? Would be great if I was just missing a simpler method.

andypi
Frequent Visitor

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 (38,666)