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

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Validating by Summing Decimal Values Sometimes Works and Doesnt Work

(0) ShareShare
ReportReport
Posted on by 6
I have something fairly bizarre and I'm fairly sure I'm missing something simple.
 
I have a Visible formula where it sums up the numerical(decimal places allowed) values of 4 fields.  If the sum of 4 fields match, the error display is hidden.  If it does not match, error display is shown.  Here's an example.
 
Since Element K is input as $150.99 and it doesnt equal to $135.34, the error in red shows.  If I fix the value of K, it'll behave as expected as shown here:
 
A user who was testing was able to find a combination where even though the validation should pass, it still throws up an error as if the rule is not matching.
 
It doesn't make sense that the above should still throw a validation error.  Clearly the sum of fields G H I J matches the value of K but Powerapps sees it as a non-match.  I thought having 0 as a value on some fields was the culprit but doesn't seem to be the case.  From what I tested so far, doing whole numbers without decimals always works.  Its some combinations that have decimal values that this seems to happen.  Here are some other examples I found.
 
 
 
 
There are many combinations that work as well.  I'm just not sure why there are a number of combinations where it doesnt work in the same space.
 
Below is my formula used on the Visible section to make this happen.  Any insights anyone may have on what I'm missing here would be greatly appreciated!
 
If( IsBlank(P2P_Element_K_Value.Text) || Value(P2P_Element_K_Value.Text) <> Sum(Value(P2P_Element_G_Value.Text), Value(P2P_Element_H_Value.Text) ,Value(P2P_Element_I_Value.Text)
,Value(P2P_Element_J_Value.Text)), true, false)
 
 
I have the same question (0)
  • Verified answer
    Chriddle Profile Picture
    8,370 Super User 2025 Season 2 on at
    Validating by Summing Decimal Values Sometimes Works and Doesnt Work
    I assume you are having problems with the accuracy of floating-point numbers.
    This also occurs in PowerApps, as you can easily test:

    The usual solution is to calculate with Integers (here cents).
  • Chriddle Profile Picture
    8,370 Super User 2025 Season 2 on at
    Validating by Summing Decimal Values Sometimes Works and Doesnt Work
    With your numbers:
  • Verified answer
    Power Apps 1919 Profile Picture
    1,373 on at
    Validating by Summing Decimal Values Sometimes Works and Doesnt Work
    Hi , can you try this formula
    If(
        IsBlank(P2P_Element_K_Value.Text) || (Round(
            Value(P2P_Element_K_Value.Text),
            2
        ) <> Round(
            Sum(
                Value(P2P_Element_G_Value.Text),
                Value(P2P_Element_H_Value.Text),
                Value(P2P_Element_I_Value.Text),
                Value(P2P_Element_J_Value.Text)
            ),
            2
        )),
        "No Match",
        "Match"
    )
    when i tried your formula , i observed the decimal digits are not matching (don't know why ) but when i apply round functions on both sides , it is working again.

    example: (see , sum is 35.660000000000000000000004) 

  • EC-19110056-0 Profile Picture
    6 on at
    Validating by Summing Decimal Values Sometimes Works and Doesnt Work
    Thanks Chriddle and Power Apps 1919 for your responses.  That made total sense.  I had completely forgotten about float-point accuracies.  I knew it was something obvious like that.  Your solutions have solved my issue.  Thanks again!

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

Coming soon: forum hierarchy changes

In our never-ending quest to improve we are simplifying the forum hierarchy…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 651 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 385 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 230 Super User 2025 Season 2

Last 30 days Overall leaderboard