2 Replies Latest reply: Sep 19, 2016 4:18 PM by Pam Dunn RSS

    Color by as a % of total

    Pam Dunn

      Hi,

       

      New to Qlik Sense but have used other visualization products and have a simple request. I need to create a color by expression that will color my chart if the segments are more than 10% of the total. My example is I have product sales and if any products individual sales are over 10% of the total sales than color them a different color than all the rest. How do I evaluate each individually as part of the total?Qlik - color by.jpg

        • Re: Color by as a % of total
          paul bolick

          Edit the visual, go to Properties, Appearance, Colors and Legends.

          Change the color from 'Auto' to Custom, and select By Expression.

          for your example, use:

          If (sum([Sales]) > sum(total [Sale]) * .1,

              lightgreen(),  //or an RGB color. this is the True condition

              lightred()  //or the color of your choice. this is the false condition

              )

           

          If you always want to color based on the total sales regardless of what is selected, then change the expression to:

          If (sum([Sales]) > sum( {1} total [Sale]) * .1,

              lightgreen(),  //or an RGB color

              lightred()

              )