web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Countrows returns diff...
Power Apps
Unanswered

Countrows returns different values from gallery or collection depending on same data-source

(0) ShareShare
ReportReport
Posted on by 62

Here's one of those things... Probably some silly mistake I've made...

 

If I run Countrows on my gallery, the value it returns is 100, if the gallery draws data from a SP list, or 216 if the gallery draws data from a collection from the same SP list. Here's how:

 

Case 1

MyGallery Items: Filter(MyList, ColumnA=Value1)

Countrows(MyGallery.AllItems)=100

 

Case 2

MyCollection = MyList 

MyGallery Items: Filter(MyCollection, ColumnA=Value1)

Countrows(MyGallery.AllItems)=216

 

Note: the SP list has 288 items total; the row limit setting for the app is 2000

 

Thanks for shedding some light!

Categories:
I have the same question (0)
  • BCLS776 Profile Picture
    8,994 Moderator on at

    Galleries initially load data 100 records on external data sources for performance reasons, which is why you get a CountRows() = 100 on the gallery's AllItems. Scrolling through the items will trigger the gallery to load more.

     

    You are better off running the CountRows() on the same filter used to populate the gallery's Items property, to get an accurate count up to the row limit of the app.

     

    Hope that helps,

    Bryan

  • timl Profile Picture
    37,246 Super User 2026 Season 1 on at

    Hi @Gilmour1 

    Countrows(MyGallery.AllItems) will return a count of the number of rows in MyGallery.

    The rows in the gallery are loaded in batches. If you open MyGallery, scroll to the bottom and continue scrolling until all 216 records are loaded, Countrows(MyGallery.AllItems) should then return a count of 216.

  • Bartelli Profile Picture
    75 on at

    I found a video by Shane Young that will help:  https://youtu.be/gtNCYMdOOag?si=EHS2YoFROAf2LgAo 

     

    Please let me know if this resolves your counting issue.  Thanks!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 320 Most Valuable Professional

#2
11manish Profile Picture

11manish 210

#3
Valantis Profile Picture

Valantis 167

Last 30 days Overall leaderboard