The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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.
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:
Thank you all!!
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.
User | Count |
---|---|
15 | |
11 | |
8 | |
8 | |
7 |
User | Count |
---|---|
21 | |
20 | |
11 | |
10 | |
7 |