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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
SaaM
Helper II
Helper II

DAX total != total rows

Hi, 

I have an issue where the total of the rows is not equal to the total calculated in a table, let me explain what I mean: 

SaaM_0-1764345271353.png

I calculate first the difference between the CA N and CA N-1 that I store in diff_CA measure
and I store in Calcul_incremental measure:

- if (diff_CA >0, diff_CA, 0)

and I except the total to be 129 367,62 +0,00 = 129 637.62 and not 129 367.62 -263.86 = 129 103.76

What am I doing wrong here to fix the total taking into account not the values calculated with the condition ? 

 

Thank you in advance
Kind regards,

 

1 ACCEPTED SOLUTION

Hi @SaaM ,

 

It is likely that your total doesn't work because you have multiple columns which is affecting your filter condition.  In order for the sumx solution to work you will need to incorporate all the filter condition columns into your sumx formula.  An example of the formula is as shown below:

Calcul_incremental_Total = 
SUMX(
    SUMMARIZE(
        'YourTable', 
        'YourTable'[Column1], 
        'YourTable'[Column2]
    ),
    IF([diff_CA] > 0, [diff_CA], 0)
)

 Would you like me to generate the exact dax formula to fix the total? If so, please let me know which columns are currently listed in the rows section of your table visual.

 

Best regards,

View solution in original post

6 REPLIES 6
vaibhavmahajan
Advocate I
Advocate I

Hi @SaaM,

I hope you are doing well today 🙂❤️

 

There are two solutions you can use to fix the totals issue in your table visual.

Both ensure the total equals the sum of the row values:

 

Solution 1: Using SUMX with IF

Calcul_incremental :=
SUMX (
    VALUES ( YourTable[YourRowColumn] ),
    VAR Diff = SUM ( YourTable[CA N] ) - SUM ( YourTable[CA N-1] )                  
    RETURN
        IF ( Diff > 0, Diff, 0 )
)
  • Evaluates row by row
  • Applies the condition per row
  • Totals now match the sum of rows

 

Solution 2: Using SUMX with MAX (shorter)

Calcul_incremental :=
SUMX (
VALUES ( YourTable[YourRowColumn] ),
MAX ( SUM ( YourTable[CA N] ) - SUM ( YourTable[CA N-1] ), 0 )
)                          
  • Shorter, cleaner syntax
  • Works exactly the same
  • Ensures totals equal the sum of rows

 

Work Notes:

  • Replace YourTable[YourRowColumn] with the column that defines each row in your table
  • e.g., Customer, Account, Product
  • Both approaches work for table, matrix, and card visuals

 

If this answer helped, kindly give Kudos and mark it as the Accepted Solution

to help other members find it more quickly.

 

Best regards,

Vaibhav Mahajan

LinkedIn: https://www.linkedin.com/in/vaibhavnmahajan

Rufyda
Super User
Super User


I'm glad you found a solution! We're here in the community to support each other.

Regards,
Rufyda Rahma | MIE

Zanqueta
Super User
Super User

Hi @SaaM,

This behaviour is expected because of how DAX calculates totals: the total is not the sum of the row results, but a recalculation of the measure in the total context (all rows combined). In your case:
  • For each row:
    Calcul_incremental = IF(diff_CA > 0, diff_CA, 0)
    works correctly because diff_CA is evaluated per row.
  • For the total:
    The same formula runs in the grand total context, where diff_CA is aggregated across all rows first. If the combined diff_CA is negative, the condition fails, and the total shows a smaller value.

 

Please, try something like this:

Calcul_incremental =
SUMX(
    VALUES('YourTable'[YourGroupingColumn]),
    IF([diff_CA] > 0, [diff_CA], 0)
)

 

If this response was helpful in any way, I’d gladly accept a 👍much like the joy of seeing a DAX measure work first time without needing another FILTER.

Please mark it as the correct solution. It helps other community members find their way faster (and saves them from another endless loop 🌀.

If this response was helpful in any way, I’d gladly accept a kudo.
Please mark it as the correct solution. It helps other community members find their way faster.
Connect with me on LinkedIn

unfortunately it is not as I don't get the result expected using the formula suggested: 

SaaM_0-1764346412017.png

How should I proceed to have the total that equals 0.00 + 129367.62 

Thanks
Kind regards, 
SaaM

Hi @SaaM ,

 

It is likely that your total doesn't work because you have multiple columns which is affecting your filter condition.  In order for the sumx solution to work you will need to incorporate all the filter condition columns into your sumx formula.  An example of the formula is as shown below:

Calcul_incremental_Total = 
SUMX(
    SUMMARIZE(
        'YourTable', 
        'YourTable'[Column1], 
        'YourTable'[Column2]
    ),
    IF([diff_CA] > 0, [diff_CA], 0)
)

 Would you like me to generate the exact dax formula to fix the total? If so, please let me know which columns are currently listed in the rows section of your table visual.

 

Best regards,

Thank you so much @DataNinja777 , your solution works ! 

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.