cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pwrappr01
Level: Powered On

Is it possible to show a count of items in a gallery even when the gallery is filtered?

I have a gallery connected to a SharePoint list for which I wish to show a permanent count that does not filter when the contents of the gallery are filtered based on a particular criteria. I have no idea what the code on this would be, so any suggestions would be helpful.

6 REPLIES 6
FoDelement
Level 8

Re: Is it possible to show a count of items in a gallery even when the gallery is filtered?

Hello,

 

I think what you are looking for is CountRows.

 

Here is an example.

 

CountRows(Gallery1.AllItems)

 

Or if it was Filtered.

 

CountRows( Filter( Gallery1.AllItems, Done <> "true" ) )

Super User
Super User

Re: Is it possible to show a count of items in a gallery even when the gallery is filtered?

@pwrappr01 

DO something like this to get a count of all rows in your datasource independent of any filters on the gallery.  Please note, CountRows only works until the delegation limit which is 500 by default (but can be increased to a maximum of 2,000 records).

 

CountRows(your_datasource_name)

 

DO NOT do something like this because the result will be inaccurate.  Galleries can show all of the records in a delegable datasource but only load 100 values at a time.  For example, your datasource could have 1,000 records but your count would only show 100 until you scroll to the end of the Gallery.

 

CountRows(Gallery1.AllItems)

 

---
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."

pwrappr01
Level: Powered On

Re: Is it possible to show a count of items in a gallery even when the gallery is filtered?

@FoDelement, thank you for the suggestions, but the count from CountRows(Gallery.AllItems) is being filtered when a search is performed to filter the contents of the gallery itself. I am wondering if there is a way to always count the rows in the gallery as if it were not filtered.

Super User
Super User

Re: Is it possible to show a count of items in a gallery even when the gallery is filtered?

@pwrappr01 

See my post above.

pwrappr01
Level: Powered On

Re: Is it possible to show a count of items in a gallery even when the gallery is filtered?

@mdevaney , Thanks for the warning. What if I need to have a single filter take effect on the data source and want to count the rows that way?

Super User
Super User

Re: Is it possible to show a count of items in a gallery even when the gallery is filtered?

@pwrappr01 

To show the count with a single filter applied you could do something like this...

 

CountRows(
Filter(
your_datasource_name,
Status.Value = "In Progress"
)
)

 

---
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."

Helpful resources

Announcements
thirdimage

New Badges

Check it out!

thirdimage

Power Apps 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

Top Solution Authors
Top Kudoed Authors
Users online (6,326)