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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Yerece
Regular Visitor

Bug when using Summarize inside SumX

Hello,

 

I need to summarize a table to use it within a SUMX function. The creation of the table works as expected because I created a calculated table to check it.

DAX
Var Weighted_Score = CALCULATETABLE(
ADDCOLUMNS(
SUMMARIZE('OpenWells Principal', 'Responsável'[Responsável], 'Intervenções'[Intervenções], 'Dados Sondas'[Casco / Capacidade]),
"Nota5", [Nota Logística 5],
"Proporcao", [Proporçao Un Operacional]
)
)

Then I use this table in SUMX:

 

DAX
Var Sum_Score = SUMX(Weighted_Score, [Nota5] * [Proporcao])

What's happening strangely is that within the [Nota Logística 5] measure, there's a condition for when another measure called [Principal total OW (P50)] is equal to zero. The condition is as follows:

DAX
Nota Logística 5 =
Var Realized = [Principal total OW (P50)]
Var Target = [Meta P50 logística]
Var Score4 = [Nota Logística 4]
Var Total_tt = [Principal total OW operações (hs)]

SWITCH(TRUE(),
Realized > 0 && Target > 0, Score4,
Target = BLANK() && Total_tt > 0, 50,
OR(Realized = 0, Realized = BLANK()) && Total_tt > 0, 100
)

So, when I insert the virtual table into the SUMX, the condition is completely ignored. Everything is normal in the virtual table, as can be seen in the table below.

Yerece_2-1693601313068.png

 

However, when this table enters as a variable within the SUMX, it cannot calculate the score when [Principal total OW (P50)] = zero. It looks like this:

Yerece_3-1693601331118.png

Thank you all!!




1 REPLY 1
lbendlin
Super User
Super User

Use EVALUATEANDLOG  to observe the different filter contexts, the transitions, and the lineages.  Then refactor your code to achieve your requirement.  For development work you should avoid nesting measures inside each other, that makes it really hard to troubleshoot.

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.