cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DHAGZ
Helper III
Helper III

Count List

Good Day!

How to count All list of Datatable based on Filter



thanks and advance

2 ACCEPTED SOLUTIONS

Accepted Solutions
Drrickryp
Super User
Super User

@DHAGZ 

Wrap the Items property of the datatable in CountRows(). Put that formula in the Text property of a label.

View solution in original post

v-albai-msft
Community Support
Community Support

Hi @DHAGZ ,

What do you want to count?

Do you want to count the number of the filtered items from a datasource?

If yes, as @Drrickryp suggested , you can use CountRows() function.

For example, I have a SharePoint list with a "Brand" column, I want to count the number of items with a particular brand(like "Apple"), so I can add a label control, then set its Text property to this(replace to your DataSource name):

CountRows(Filter(DataSourceName, Brand="Apple"))

v-albai-msft_0-1619597543809.png

You can also use this formula, both gets count number successfully:

CountIf(DataSourceName, Brand="Apple")

v-albai-msft_1-1619597668567.png

 

Note: If your DataSource is also a SharePoint list like my example, above formula may cause Delegation issue, you could consider to save your SPList into a Collection, then use the Collection as data source within your formula.

You can refer to Example section mentioned in this article to learn more about how to "count all records in a table, or count all records that satisfy a condition":

Count, CountA, CountIf, and CountRows functions - Power Apps | Microsoft Docs

Best regards,

Allen

View solution in original post

4 REPLIES 4
Drrickryp
Super User
Super User

@DHAGZ 

Wrap the Items property of the datatable in CountRows(). Put that formula in the Text property of a label.

View solution in original post

DHAGZ
Helper III
Helper III

@Drrickryp  how ?

Please show the Items property of your datatable with the Filter().

v-albai-msft
Community Support
Community Support

Hi @DHAGZ ,

What do you want to count?

Do you want to count the number of the filtered items from a datasource?

If yes, as @Drrickryp suggested , you can use CountRows() function.

For example, I have a SharePoint list with a "Brand" column, I want to count the number of items with a particular brand(like "Apple"), so I can add a label control, then set its Text property to this(replace to your DataSource name):

CountRows(Filter(DataSourceName, Brand="Apple"))

v-albai-msft_0-1619597543809.png

You can also use this formula, both gets count number successfully:

CountIf(DataSourceName, Brand="Apple")

v-albai-msft_1-1619597668567.png

 

Note: If your DataSource is also a SharePoint list like my example, above formula may cause Delegation issue, you could consider to save your SPList into a Collection, then use the Collection as data source within your formula.

You can refer to Example section mentioned in this article to learn more about how to "count all records in a table, or count all records that satisfy a condition":

Count, CountA, CountIf, and CountRows functions - Power Apps | Microsoft Docs

Best regards,

Allen

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,774)