Forum Discussion

Atchaya-Prabhu's avatar
Atchaya-Prabhu
New Member
3 years ago

Dax

  I have A column and has a list of value 
Also B column with list of value . i want to see the difference of A  and B column

For example:

 A as 18.89% AND B as 12.48% i want to see the value output as +6% but when i try it shows as 
+60%
This is my DAX:
Difference(%) = VAR DifferenceValue = DIVIDE([A] - [B], [B]) RETURN IF(DifferenceValue >= 0, "+" & FORMAT(DifferenceValue * 100, "0"), FORMAT(DifferenceValue * 100, "0") ) & "%"

Can i know how to see the value as+6%? anyone please


amitchandak 

2 Replies

  • rsbin's avatar
    rsbin
    Community Champion

    Atchaya-Prabhu ,

    Just change your VAR to [A] - [B]

    Difference(%) = 
    VAR DifferenceValue = [A] - [B]
    RETURN IF(DifferenceValue >= 0, "+" & FORMAT(DifferenceValue * 100, "0"), FORMAT(DifferenceValue * 100, "0") ) & "%"

    Hope this is what you were looking for.

    Regards,

     

  • nvprasad's avatar
    nvprasad
    Solution Sage

    Hi Prabhu,

    Please check the below DAX measure to get expected result.

     

    Different % =
    Var check1 = ('Table'[a]-'Table'[b])
    Var Positiveresult =  "+ "&CONVERT(check1 *100,STRING) &"%"
    Var Negativeresult = "- "&CONVERT(check1 *100,STRING) &"%"
    Var Finalresult = IF(check1>0,Positiveresult,Negativeresult)
    Return Finalresult
     

     

    Appreciate a Kudos! ‌‌
    If this helps and resolves the issue, please mark it as a Solution! ‌‌

    Regards,
    N V Durga Prasad