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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
technologyLMM
Frequent Visitor

Measure count

Hi,
i have created the following measure, which is working properly in the below table for each row, except of the grand total:
fyi, if there is a cross in a row, the last column (check measure) shall be 1.
 
check measure=
var a = [HFO ROB - Cons Dev (%)]
var b = [LFO ROB - Cons Dev (%)]
var c = [MGO ROB - Cons Dev (%)]
return
CALCULATE(COUNT('CII'[Vessel]),filter('cube_db telegrams'a>0.05 || b>0.05 || c>0.05))
 
However, in the last line, the total is not properly calculated. Grand total is 9, instead of 1. 
 
technologyLMM_0-1692448891963.png

Could you please advise what am i missing?

 

thank you in advance

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @technologyLMM 
There are some workarounds to fix totals, please refer linked tutorial of @Greg_Deckler:

https://www.youtube.com/watch?v=dgwsk2fjWLc

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

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @technologyLMM ,

 

There are different ways to fix this issue, depending on your specific situation and desired outcome. Some possible solutions are:

Use the HASONEFILTER or HASONEVALUE functions to check if there is only one value in the filter context and return a different calculation for the total row. Here is the updated measure:

check measure =
VAR a = [HFO ROB - Cons Dev (%)]
VAR b = [LFO ROB - Cons Dev (%)]
VAR c = [MGO ROB - Cons Dev (%)]
RETURN
IF(
    HASONEVALUE('CII'[Vessel]),
    CALCULATE(COUNT('CII'[Vessel]), FILTER('cube_db telegrams', a > 0.05 || b > 0.05 || c > 0.05)),
    COUNT('CII'[Vessel])
)


Use the SUMMARIZE or SUMMARIZECOLUMNS functions to create a table with the desired level of granularity and then apply your measure to that table.


Use the DIVIDE function to handle any division by zero errors that might affect the total row.

           

Reference:

Fix Bad Measure Totals in Power BI and Power Pivot - YouTube

Power BI Shows Incorrect Measure Total? How to fix it? - YouTube

Solved: Grand total calculation - Microsoft Fabric Community

Fixing Incorrect Totals Using DAX Measures In Power BI | Enterprise DNA

Solved: Re: Incorrect Grand Total of measures - Microsoft Fabric Community

 

 

                                                                                                                                            

Best Regards,

Stephen Tao

 

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

sergej_og
Super User
Super User

I think your processing result (=9) is correct. You calculate a count of vessels.
You have 9 rows above your Total line. Your result = 9.
Behind the scenes the "Total" line consists of 9 rows (in your case). These 9 rows contain cross (red) and checks (green). Both categories. How to decide for DAX when both cases are present?
For DAX there no explicit filter context for "Total" like in each row above.

But I know what you mean!
It is bit confusing.

Ritaf1983
Super User
Super User

Hi @technologyLMM 
There are some workarounds to fix totals, please refer linked tutorial of @Greg_Deckler:

https://www.youtube.com/watch?v=dgwsk2fjWLc

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

 

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors