Forum Discussion
DIVIDE DAX with error when using 2 numerators
Hi, I'm trying to calculate a percentage index of goal/accomplished.
But the divide function is causing defect in matrix display when using 2 numerators in the divide function.
For a reason I don't know, when use 2 numerators in divide formula, the page filter "year" doesn't works. The matrix show me all dates avaiable in my date dimension table.
The formula is:
DIVIDE (number1 - constant, number2 - constant)
Where the constant is represented by the measure [LINHA BASE MARG] with value 0.25
See:
When I use only one numerator, it works as expected (except by the fact that I have the wrong result because is lacking one value in numerator divide formula):
Any solution?
Hi Anonymous ,
I see.
If you return ICM,you will find that the measure without constant value still showing result only for 2021:
But the measure with constant value are showing values with all the years:
It means that the if condition doesn work in your measure,so try to modify your measure as below:
ICM MARG = VAR _ARG1 = [% MARGEM SM] - [LINHA BASE MARG] VAR ARG2 = [META MARG] - [LINHA BASE MARG] VAR ICM = DIVIDE(_ARG1, ARG2) //verificar porque quando o numerador do divide tem um número sendo subtraído a matriz perde o filtro do ano VAR RESUL = IF(ICM < 0, BLANK(), ICM) RETURN RESULAnd you will see:
The result only contains the value in 2021.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
16 Replies
- aj1973Community Champion
Hi Anonymous
add VAR for each equation then use them in Divide:
var _1 = A-B
var _2 = C-D
var _Divide = DIVIDE( _1 ,_ 2 , 0)
RETURN
_Divide
or use _Result = (A-B) / (C-D)
- AnonymousNot applicable
The issue persist:
- aj1973Community Champion
Can you verify and RETURN
ARG1
ARG2
and show the result please?