1 Reply Latest reply: Feb 22, 2017 2:25 PM by Andy Weir RSS

    Changing background color based on text

    Bill Duke

      Hi All,


      New to Qlik Sense but been around Qlikview for 8 years. I am trying to change the background color of an individual cell based on a text value.


      I have a column named statCol  which could be 1 on the following possibilities : 'R', 'G' or 'Y'


      In the Background Color Expression I have entered :


      If(statCol= 'R', red(),

          If(statCol = 'G', green(),

                If(statCol = 'Y', yellow(),lightgray())))


      The background color based on the first rows value of statCol is repeated for every row instead of being painted based on the expression for each individual row/col . Is this normal Qlik Sense functionality?


      I have searched but can't find out if what I am trying to do is not possible or is my expression  poorly written?


      Kind Regards,


        • Re: Changing background color based on text
          Andy Weir

          It should work Bill


          I just applied to one of my tabes and it worked as expected


          Inserted in Background Exprenssion


          If(NOC = 'Great Britain (GBR)', red(),


              If(NOC ='United States (USA)', green(),


                    If(NOC = 'China (CHN)', yellow(),lightgray())))


          And got this...



          As long as your column is a Dimension rather than measure it should work.