Forum Discussion
Unexpected results with DAX ABS function
Please try this expression instead for your second measure. Your current one is calculating the same SUM and then taking the absolute value. This one will take the ABS on each row, and then sum the result of all those values.
Cantidad_ABS_2 = SUMX(MA_TRANSACCION, ABS(SUM(MA_TRANSACCION[Cantidad])))
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
- bsmartbkind6 years ago
Advocate I
Thank you very much for your answer.
It seems to me that your formula has an error and should be like this:
Cantidad_ABS_2 = SUMX(MA_TRANSACCION, ABS(MA_TRANSACCION[Cantidad]))), it means by taking the SUM out inside the ABS, otherwise the results are incorrect.
However, even so the problem is not solved and we go back to the problem raised in my first question, why does ABS change the value in some records?.
I'll leave you some pictures.
Results with the measure as you suggested it;
Cantidad_ABS_2 = SUMX(MA_TRANSACCION, ABS(SUM(MA_TRANSACCION[Cantidad])))
Result by taking out the SUM inside the ABS;
Cantidad_ABS_2 = SUMX(MA_TRANSACCION, ABS(MA_TRANSACCION[Cantidad]))
- mahoneypat6 years ago
Microsoft Employee
My bad on leaving the SUM inside the SUMX. Silly mistake. The issue you are seeing is weird. Do some C_Numero values have multiple rows? What if you try MIN or MAX to troubleshoot?
Regards,
Pat