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
Unanswered

Sum + filter

(0) ShareShare
ReportReport
Posted on by 65

In my app I make a sum using the Sum formula (Powerapps_Fechamento_Diario; Setor_Status.Value = "Contabilidade" And Empresa = "Embalagens) the result appeared. However, my table just reached 500 records and stopped working. use the filter, but I couldn't, I did it like Sum (Filter (Powerapps_Fechamento_Diario; Setor_Status.Value = "Contabilidade" And Empresa = "Embalagens)) but the error in the formula. What can it be?

I know that I can increase from 500 to 2000 and solve the problem in a palliative way. But I want a definitive solution. Thank you

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @straiderox2 

    Your issue seems to be related to the number of records that match your filter.  If you have more than 500 (and ultimately more than 2000) in your filter results, then you will need to devise a different strategy to do this.

    Some options available are to collect all the values in a collection with multiple filters that can contain as many records as you have memory for.  Then you can perform your Sum function against the collection.

    In general for record limits and ultimately delegation issues, you will want to find a narrowing filter that returns less than the limit and then perform functions against the results of that.  But in your case, it seems the narrowing of the records still returns more than the limit, so you'll need to look at collecting the records in a different way and then Sum against that.

     

    I hope this is helpful for you.

  • roamer7485 Profile Picture
    112 on at

    This suggested solution works both on Sharepoint and SQL Server. Create an integer field or column in your source table, make 1 as a default for it. In all my tables, I call that extra field "ic" as integer count, or whatever you may call it. So every time a new record is added, 1 is automatically given to its "ic". You see a number is delegable to the backend in both Sharepoint and SQL Server. So if you make "ic" as a parameter in your Sum() function, you get the sum of all your records no matter if they exceed 2000 rows. 

     

    Here's an example on how I'm using that extra field for counting the number of records. In all my apps, it's been my practice to give a user an info about how many records there are in the datasource when he filters the gallery by entering some characters in a textbox. It's an extract of a record counting block of code in my equipment maintenance app.

     

    Sum(
             Search(
                          Filter( 'mySQLServerDatasource', (ic = 1) ),
                                     Trim(txtSearch.Text),
                                     "EQUIPID",
                                     "EQUIP_DESCR",
                                     "STAGE_ID",
                                     "FACILITY",
                                     "TYPENAME",
                                     "MAINT_TEMP",
                                     "PROVIDER",
                                     "SPECIALIZED",
                                     "BYPASS_REASON"
                          ),
             ic
    )

     

    I put this block of code behind the text property of a label that shows the record count.

     

    1.) First, the Filter() function filters against the datasource with "ic=1". 

    2.) Then Search() searches for records which fields that may contain the string of characters in the trimmed txtSearch.Text . The user types some characters into this textbox to search.

    3.) Finally, the Sum() function sums up the resultset's ic. This is now the count of records.

     

    Instead of using CountRows() to count the number of records, I use Sum() against the "ic" to give me the count of records. I watched someone's video that does similar way to count the records with more than 2000 records but he used Flow to do it. He passed some parameters for Flow to do his CountRows. My method doesn't need Flow to get the count; it's using Sum() with that extra integer field with 1 as the default.

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 431

#2
WarrenBelz Profile Picture

WarrenBelz 360 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 280 Super User 2026 Season 1

Last 30 days Overall leaderboard