cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

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
Highlighted
Responsive Resident
Responsive Resident

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

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

Highlighted
Helper V
Helper V

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.

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

Highlighted
Helper V
Helper V

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?

Highlighted
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
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,297)