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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Power BI Miscalculating decimals

Can someone please explain to me why or how PowerBI gets to this value when summing decimals.

 

Power BI:

Hugh_0-1638463077310.png

 

Excel:

Hugh_1-1638463109474.png

 

1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

This is due to the measure context. For example, I have the following example data and then I use the formula to create the measure, then the totals section will show the sum of the value of the largest type (i.e. the sum of type d is 5). 

TypeValue

a 5
a 10
b 1
b 2
b 3
c 4
d 5

 

SUM_Value = 
CALCULATE (
    SUM ( 'Table'[Value] ),
    FILTER ( ALL ( 'Table' ), 'Table'[Type] = MAX ( 'Table'[Type] ) )
)

vkkfmsft_0-1638845830268.png

 

So if you want the Total to sum all values, then a general formula is:

 

Total_SUM = 
IF (
    ISFILTERED ( 'Table'[Type] ),
    [SUM_Value],
    SUMX ( ALLSELECTED ( 'Table'[Type] ), [SUM_Value] )
)

vkkfmsft_1-1638845978643.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

This is due to the measure context. For example, I have the following example data and then I use the formula to create the measure, then the totals section will show the sum of the value of the largest type (i.e. the sum of type d is 5). 

TypeValue

a 5
a 10
b 1
b 2
b 3
c 4
d 5

 

SUM_Value = 
CALCULATE (
    SUM ( 'Table'[Value] ),
    FILTER ( ALL ( 'Table' ), 'Table'[Type] = MAX ( 'Table'[Type] ) )
)

vkkfmsft_0-1638845830268.png

 

So if you want the Total to sum all values, then a general formula is:

 

Total_SUM = 
IF (
    ISFILTERED ( 'Table'[Type] ),
    [SUM_Value],
    SUMX ( ALLSELECTED ( 'Table'[Type] ), [SUM_Value] )
)

vkkfmsft_1-1638845978643.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

HotChilli
Super User
Super User

  The best way to start is to acknowledge that totals are not incorrect, they're just not what you want in the situation at hand.

There are some solutions here:

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376 

and

https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907 

 

You can also search the forum for 'wrong totals' or similar.  You won't be short of responses

HotChilli
Super User
Super User

Is it an addition or is it a measure totals issue?

Anonymous
Not applicable

So my issue is that I have percentages per category, and I would like to get the average percentage dependant on the number of catagories selected. I'm unable to get accurate values because of the decimals are summed incorrectly.

 

Hugh_0-1638463857963.png

This is the percentage that the DAX returns:

Hugh_1-1638463925411.png

 and it should be: 

Hugh_2-1638464075002.png

 

Anonymous
Not applicable

I think it is a measure total issue.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.