Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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...
  • v-kelly-msft's avatar
    v-kelly-msft
    5 years ago

    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  RESUL

     

     

    And you will see:

    The result only contains the value in 2021.

     

     

    Best Regards,
    Kelly

    Did I answer your question? Mark my post as a solution!