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

function countif

(0) ShareShare
ReportReport
Posted on by 90

Hi, sorry my english ... I have a problem to solve ... I need to count the records of a table, but when I exceed 2000 records the result is wrong. I tried the following Sum function (ForAll (Filter ('[dbo]. [USR_RIG_INVENTARI]'; CODINV = Dropdown2.Selected.CODICE); 1); Value), but it gives me the value 2000, when instead the lines are 296628. I also tried with the Countif function, but it reports incorrect values. Could you help me understand?

Immagine.jpg
Categories:
I have the same question (0)
  • mdevaney Profile Picture
    29,991 Moderator on at

    @gioce

    The SUM and COUNT functions cannot be delegated.  Therefore you will only get the 1st 2,000 results when using them.

     

    Link to MS Delegation Article

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/delegation-overview

     

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

  • gioce Profile Picture
    90 on at

    is there an alternative to count records that exceed 2000? thank you

  • mdevaney Profile Picture
    29,991 Moderator on at
    @gioce
    The answer is complicated... it depends.

    There is no function in PowerApps to CountRows over 2,000. However, you could calculate that in a table in your database or keep a count of it and simply display that number. It’s too long to explain the method here but I am considering doing a blog article about it.

    Another idea is simply to use the last ID number of the table assuming no records get deleted.

    —-
    Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.
  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    @gioceYes, Counting function is not delegable for SQL. But as an alternative workaround, I often use CountRows() function directly on the gallery from SQL, because the SQL is delegable, so the gallery can get all records. Please check this.

    1. Add a gallery, set Items property: [dbo]. [USR_RIG_INVENTARI]

    2. Set Text of Label:  CountRows(Gallery1.AllItems)

    Note: there is no need to display the gallery, set its Visible property to false

    Sik

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 839

#2
Valantis Profile Picture

Valantis 533

#3
Haque Profile Picture

Haque 412

Last 30 days Overall leaderboard