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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kwahila
Regular Visitor

Grand Total of measure doesn't equal sum of row values

Dears,

 

This is a fundamental question I am trying to anwser and am getting lost in the forums with different ideas. I have a measure that I put into a table. When the grand total of each column is turned on for the table, it does not actually equal the sum of the individual elements in the rows. It is just too strange. Why should the way the measure is written impact the fact that the grand total should just be the simple sum? Please help?

 

Regards,

Kevin

 

1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey,

 

there are some reasons why the measure shows not the "simple" sum of the values from the column, this is often due some filtering of the rows aggregated by measures. It could be possible that the measure on the Grand Total aggregates more rows than the detail row.

 

Here you will find a simple pbix file, that shows some average weirdness. The measure Simple Average just calculates the rows, this leads to a Grand Total value that is in a way correct, but maybe not expected. The Measure "Not So Simple Average" shows the same values on the detail level (the rows of the table visual), but for the Grand Total it calculates the average of each Category.

2017-10-05_9-35-44.png

 

Another reason could also be the aggregate function DISTINCTCOUNT(...), it counts the distinct value of a column available in the rows that are filtered. If there are Month on rows in the same customer buys something in each month, the value will be 1 for each month but not 12 for the Grand Total.

 

So, without having more information about your measure and the structure of your table or matrix visula, it's just guesswork.

 

Hope this gets you started

 

Regards

Tom 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

5 REPLIES 5

Most likely cause is that you turned on bidirectional filtering on some relationship. Bidirectional filtering is very powerful, but it is also very dangerous, as its behavior is non-additive in most scenarios and not-so-easy to understand at first sight.

 

Try to turn it off, and let me know if that was the case.


Have fun with DAX!

Alberto Ferrari
http://www.sqlbi.com

Alberto Ferrari - SQLBI
Anonymous
Not applicable

Ciao @AlbertoFerrari and @marcorusso ,

I have a similar scenario when using a LASTNONBLANK function for a closing balance where the total for the visual doesn't equal the sum of the detail rows, but it's only off by a small margin, i.e. < 1%, each time.  This leads me to believe that it's an order of operartions or data type issue, but everything is in a decimal format.

For example the visual below shows a total of $225,441,095.23 for the following measure:

 

Total (USD) = calculate(SUM(AR[total_usd]),LASTNONBLANK(AR[effdate],CALCULATE(SUM(AR[total_usd]))))
 
However, the actual total when adding all of the InvDate rows equals $225,441,095.25! So there is a difference of $.02! This is occurring intermittently but it's never a large margin of error.
 

invtotal.GIF

 

The raw data includes columns from the the AR table: [total usd], [InvDate], and [EffDate] per the measure for the closing balance. Basically, I want to total the balance per [EffDate] and/or [InvDate] where the closing balance is based on the [EffDate].
Is there something I'm missing or is this a Power BI Bug?
Thanks,
Ben

Check the data type of the column you are summing up. WIth Fixed Decimal Number (which is like MONEY in T-SQL) this shouldn't happen. With Decimal number (which is like DOUBLE in T-SQL) this could be a normal rounding issue. It doesn't seem to be related to LASTNONBLANK, though.

 

Anonymous
Not applicable

Thank you, @marcorusso ! It was indeed related to the data type and/or rounding, since the raw data had a precision of four decimal places but it was only showing two in Power BI.

 

Thank you,

 

Ben

TomMartens
Super User
Super User

Hey,

 

there are some reasons why the measure shows not the "simple" sum of the values from the column, this is often due some filtering of the rows aggregated by measures. It could be possible that the measure on the Grand Total aggregates more rows than the detail row.

 

Here you will find a simple pbix file, that shows some average weirdness. The measure Simple Average just calculates the rows, this leads to a Grand Total value that is in a way correct, but maybe not expected. The Measure "Not So Simple Average" shows the same values on the detail level (the rows of the table visual), but for the Grand Total it calculates the average of each Category.

2017-10-05_9-35-44.png

 

Another reason could also be the aggregate function DISTINCTCOUNT(...), it counts the distinct value of a column available in the rows that are filtered. If there are Month on rows in the same customer buys something in each month, the value will be 1 for each month but not 12 for the Grand Total.

 

So, without having more information about your measure and the structure of your table or matrix visula, it's just guesswork.

 

Hope this gets you started

 

Regards

Tom 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors