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 / Sum function does not ...
Power Apps
Unanswered

Sum function does not work correctly, different results with same dataset

(0) ShareShare
ReportReport
Posted on by 8

Hy all,

 

i have a power app containing a gallery with 540 rows (Collection size is set to 1500). The collection is filled using:

 

ClearCollect(ActualsData_temp;

     Filter('public.actualstodate_fin';
          wbs_element = Selected_WBSNumber And document_type = "ZY"
    )
)

 

Under the gallery i have a textfield containing the sum of a specific column (amount_in_local_curr). I calculate the sum using the following function:

 Sum(
            ActualsData_temp;
            amount_in_local_curr
       );
 
But, this value is never the same, it varies every time, although the number of records is always the same (540). I have checked my database (i'm using postgressql) and now exactly what the sum should be (in this case it should be 0).
What is going on? 

 

 

Categories:
  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @VERHAET ,

     

    How about using the Filter directly in Sum function:

    Sum(
     Filter(
     'public.actualstodate_fin';
     wbs_element = Selected_WBSNumber And document_type = "ZY"
     );
     amount_in_local_curr
    );;

     

    Best regards,

  • VERHAET Profile Picture
    8 on at

    This seems to work but this means that i have to execute the same filter twice (once for the collection and once for the sum..... this looks like overhead. Why does it not work when i give him the collection and ask to sum a column?

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @VERHAET ,

     

    For SQL databases, there are chances that collect records to a collection failed to get all column values. You can use ShowColumns function to include all columns you need to use in the collection:

     

    ClearCollect(ActualsData_temp;
     ShowColumns(
     Filter('public.actualstodate_fin';
     wbs_element = Selected_WBSNumber And document_type = "ZY"
     );
     "Column1";"Column2";"Column3";"amount_in_local_curr")
    )

     

    Best regards,

  • VERHAET Profile Picture
    8 on at

    Sorry, this does not do it. 

    Every time I execute the same query and then try to sum a column I get a different value.

    The collection has 540 rows, this cannot be an issue! What is going on?

     

    Is the number of columns to large (540 is not large to my opinion, i have set the limit to 1500), but the problem persists

  • mertadsay Profile Picture
    25 on at

    I think using ThisRecord resolves the issues like that. You can try:

    Sum(
                ActualsData_temp;
                ThisRecord.amount_in_local_curr
           );

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard