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.

Regular Visitor

## Wrong totals in DAX measure

Hi community team!

Hope you´re all good

Im facing an issue since a couple days. I jhave two tables with 3 important columns

Table 1: "VDC Detalle" with columns "Mes", "Cuenta", "Amount"

Table 2: "VDC DF" with columns "Mes" , "Cuenta" , "Valor".

Both of the tables "VDC Detalle" and "VDC DF" have a relationship between "Mes" and "Account"

The i write this measure to print data form "Valor" column, when the "Amount" column is empty:

This print me the correct data for each row, but the totals are wrong

How can i get the correct sum for the measure IF?

hope anyone can help me, thanks in advance PowerBI community!

1 ACCEPTED SOLUTION
Community Support

Hi @Scarevan ,

I think you can try code as below.

``````IF =
SUMX (
SUMMARIZE (
'tablename'[mes],
'tablename'[cuenta],
"IF",
IF (
SUM ( 'VDC Detalle'[Amount] ) = BLANK (),
SUM ( 'VDC DF'[Valor] ),
SUM ( 'VDC Detalle'[Amount] )
)
),
[IF]
)``````

Best Regards,
Rico Zhou

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

2 REPLIES 2
Community Support

Hi @Scarevan ,

I think you can try code as below.

``````IF =
SUMX (
SUMMARIZE (
'tablename'[mes],
'tablename'[cuenta],
"IF",
IF (
SUM ( 'VDC Detalle'[Amount] ) = BLANK (),
SUM ( 'VDC DF'[Valor] ),
SUM ( 'VDC Detalle'[Amount] )
)
),
[IF]
)``````

Best Regards,
Rico Zhou

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

Super User

because there iss no filter context on the totals, so it is not summing your calculation you probably need to do this

`if =SUMX (SUMMARIZE ( 'table'[mes], 'table'[cuenta] ),IF (ISBLANK ( SUM ( 'table'[amt] ) ),SUM ( 'table'[valor] ),SUM ( 'table'[amt] )))`

If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!

## Helpful resources

Announcements

#### 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

#### Power BI Monthly Update - April 2024

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

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors