Forum Discussion

adhumal2's avatar
adhumal2
Helper III
6 years ago

Conditional Formatting for negative values with 3 conditions

Hi Experts,

 

I want to do the conditional formatting of negative values as mentioned below. How can I achieve it with icons.

 

also , please please let me know how to work with numbers or percentages while doing the conditional formatting

 

ConditionIcon
Greater than or equal to -100 but less than or equal to -5Green Icon
Greater than -5 but leass than or equal to 0 Yello icon
Greater than 0 but less than or equal to 100Red Icon

 

11 Replies

  • Hi adhumal

     

    Please conisder this solution

     

    Create this measure and drag and drop it to your visual.

    the UNICHAR will create the icon for you.

     

    Myicon =
    VAR Myvalue = -4     -- substitute this hard code value with you measure and multiply with 100 if a %
    RETURN
    SWITCH(TRUE(),
    Myvalue < -100, BLANK(),
    Myvalue <= -5, UNICHAR(128994), -- green if > -100 and <= -5
    Myvalue <= -0, UNICHAR(128993), -- yellow if > -5 and <= 0
    Myvalue <= 100 , UNICHAR(128308), -- red if >0 and <=100
    BLANK()
    )
     
     
     
    • adhumal2's avatar
      adhumal2
      Helper III

      speedramps  Thank you. I added the measure provided by you but it only gives me the 'red' icons only. Below is the screenshot

       

      Here is the DAX 

       

      MyICON =
              VAR MYVALUE = [Difference %]
              RETURN
              SWITCH(TRUE(),
              MYVALUE<-100,BLANK(),
              Myvalue <= -5, UNICHAR(128994), -- green if > -100 and <= -5
              Myvalue <= -0, UNICHAR(128993), -- yellow if > -5 and <= 0
              Myvalue <= 100 , UNICHAR(128308), -- red if >0 and <=100
              BLANK()
      )
      • nandukrishnavs's avatar
        nandukrishnavs
        Community Champion

        adhumal2 

         

        Try this 

        MyICON =
        VAR MYVALUE = [Difference %]
        VAR RESULT =
            IF (
                MYVALUE > -1
                    && MYVALUE <= -0.05,
                UNICHAR ( 128994 ),
                IF (
                    MYVALUE > -0.05
                        && MYVALUE <= 0,
                    UNICHAR ( 128993 ),
                    IF (
                        MYVALUE > 0
                            && MYVALUE <= 100,
                        UNICHAR ( 128308 ),
                        BLANK ()
                    )
                )
            )
        RETURN
            RESULT



        Did I answer your question? Mark my post as a solution!
        Appreciate with a kudos
        🙂

    • adhumal2's avatar
      adhumal2
      Helper III

      speedrampsI tweaked the formula, but it still gives me the same result. Sorry but I am quite new to this

      Here is the DAX that i used

      Myicon2 =
                  VAR MYVALUE = [Difference %] * 100
                  RETURN 
                  SWITCH(TRUE(),
                  MYVALUE < -100, BLANK(),
                  MYVALUE <= -5, UNICHAR(128994),
                  MYVALUE <= -0, UNICHAR(128993),
                  MYVALUE <= 100, UNICHAR(128308),
                  BLANK()
                  )
  • dax's avatar
    dax
    Community Support

    Hi adhumal2 , 

    You could refer to speedramps 's suggestions, or set conditional formatting like below

    Best Regards,
    Zoe Zhi

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.