Forum Discussion
Incorrect total in DAX measure
I have this DAX measure:
The problem is that when we're in the global context, the mesure returns 0 because "Horas" is lower than "AsignadoGlobal" and I want to return the resulted total inside of the IF clause.
2 Replies
- amitchandak
Super User
Anonymous ,
Try measure like
Var TablaCalculo = ADDCOLUMNS(
VALUES('PartesTrabajo'[Empleado_ID]),
"Horas", SUM('PartesTrabajo'[Horas]),
"AsignadoGlobal", [asignado_global],
"Diff", SUM('PartesTrabajo'[Horas]) - [asignado_global]
)
RETURNSUMX(TablaCalculo,
IF(
MAX(OrdTrabGeTr[Estado]) = "Abierta",
[AsignadoGlobal], // Return the actual negative total
[Diff] // Optionally, handle other cases if needed
)
)- AnonymousNot applicable
I think that the "MAX(OrdTrabGeTr[Estado]) = "Abierta" is going to return always only one branch.
I need this condition to check if a Work Order (the record) is still open, and when is the total "case" I just want to forget it and take the result of this logic.
Given this desviation:
Is resulting in 0 because of the problem with the measure that I've described earlier.
Expected result: 0 + 14,4 + 7 + 2,5 = 23,9