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 / Error using the Sum fu...
Power Apps
Unanswered

Error using the Sum function

(0) ShareShare
ReportReport
Posted on by 23
Collect(colValores,{val: 84.7});
Collect(colValores,{val: 7.65});
Collect(colValores,{val: 7.65});
 
UpdateContext({locSum: Sum(colValores,val)})
 
//locsum = 100
//locsum > 100 returns true
//because locsum is in fact 100.0000000001
 
if i reverse the order of the collect to
 
Collect(colValores,{val: 7.65});
Collect(colValores,{val: 7.65});
Collect(colValores,{val: 84.7});
 
//locsum = 100
//locsum > 100 returns false
 
 
Categories:
I have the same question (0)
  • RobHardy Profile Picture
    154 on at
    Unfortunately, floating point errors are quite common across many programming languages / platforms.

    Since your values are all 2 decimal places or less, you could round the result to 2 places, which should fix the issue:
     
     
    UpdateContext({locSum: Round(Sum(colValores,val),2)})
  • ronaldwalcott Profile Picture
    3,847 Moderator on at
    In some of these situations such as currency it may be better to work with integer values then convert them back. 

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!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 88

#2
WarrenBelz Profile Picture

WarrenBelz 85 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 45

Last 30 days Overall leaderboard