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 / Validating by Summing ...
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)
 
 
Categories:
I have the same question (0)
  • Verified answer
    Chriddle Profile Picture
    8,691 Super User 2026 Season 1 on at
    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,691 Super User 2026 Season 1 on at
    With your numbers:
  • Verified answer
    Power Platform 1919 Profile Picture
    2,205 Super User 2026 Season 1 on at
    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
    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

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 1,055

#2
Valantis Profile Picture

Valantis 666

#2
11manish Profile Picture

11manish 666

Last 30 days Overall leaderboard