Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
powerbidu
Frequent Visitor

Does PowerBI apply rounding when applying aggregations (SUM)?

Hi all

 

I have the below sample data set. 

 

IdentifierValue
A0.05
A0.2925
A0.1575
A0.065
A0.034
A0.065
A0.136
A0.1
A0.1
B0.034
B0.2925
B0.136
B0.1
B0.1575
B0.1
B0.065
B0.05
B0.065

 

I plotted a table with two columns -  'Identifier' and 'Sum' and am interested to flag out exceptions. Exceptions are identifiers whose total sum of all rows does not equal to 1.

 

Capture.JPG

 

In the above 2 instances, the sum of all rows with Identifiers A / B add up to 1 in Excel. However it flags as an exception when applied in PowerBi. Can anyone explain to me why that might be the case (I am thinking it could be a rounding issue in Powerbi) and whether there are any ways to resolve this? I do not want Identifiers A / B to be flagged as exceptions.

 

Thanks in advance.

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @powerbidu 

Column values of type "Decimal number" are inherently approximate,  and comparing two Decimal number values for equality may give unexpected results (see documentation here).

 

Potential solutions:

1. Change the Value column to type "Fixed decimal number", which can represent values with at most four decimal places, and is internally stored as an integer value divided by 10^4.

 

2. Leave Value's type as "Decimal number" but create a flag with tolerance built-in.

For example:

Flag = 
VAR Tolerance = 1E-8
VAR ResultBool =
    ABS ( SUM ( Data[Value] ) - 1 ) > Tolerance
VAR ResultInt =
    INT ( ResultBool )
RETURN
    ResultInt

Then add a visual-level filter of Flag = 1:

OwenAuger_0-1743128924722.png

 

Having said all that, I couldn't replicate your issue with the sample data your posted. Both appeared to sum to exactly 1 for both Identifiers A & B with a column of Decimal number type. However, in general, it's best not to rely on decimal values summing exactly to a particular value.

 

Do any of the above work for you?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

View solution in original post

2 REPLIES 2
lichuang
New Member

 
OwenAuger
Super User
Super User

Hi @powerbidu 

Column values of type "Decimal number" are inherently approximate,  and comparing two Decimal number values for equality may give unexpected results (see documentation here).

 

Potential solutions:

1. Change the Value column to type "Fixed decimal number", which can represent values with at most four decimal places, and is internally stored as an integer value divided by 10^4.

 

2. Leave Value's type as "Decimal number" but create a flag with tolerance built-in.

For example:

Flag = 
VAR Tolerance = 1E-8
VAR ResultBool =
    ABS ( SUM ( Data[Value] ) - 1 ) > Tolerance
VAR ResultInt =
    INT ( ResultBool )
RETURN
    ResultInt

Then add a visual-level filter of Flag = 1:

OwenAuger_0-1743128924722.png

 

Having said all that, I couldn't replicate your issue with the sample data your posted. Both appeared to sum to exactly 1 for both Identifiers A & B with a column of Decimal number type. However, in general, it's best not to rely on decimal values summing exactly to a particular value.

 

Do any of the above work for you?


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
LinkedIn

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.