3 Replies Latest reply: Jun 12, 2017 3:23 PM by Monica Labrador RSS

    Color by expression

    Monica Labrador

      Hi, I am trying to color by expression for a pie chart. I have this as my dimension

      if(jira_ticket_number=''or jira_ticket_number =0 or isNull(jira_ticket_number) or jira_ticket_number='-' ,'In client services','Escalated to PD')

       

      and Sum(case_number) as the measure

       

      So now I want to color "In client Services" and "Escalated to PD" slices of the pie with argb(255,80,45,127) and argb(255,255,200,46)

       

      I have tried:

       

      if(jira_ticket_number=''or jira_ticket_number =0 or isNull(jira_ticket_number) or jira_ticket_number='-',

      argb(255,80,45,127),argb(255,255,200,46))

       

      but the pie is single colored making me believe that the if statement in color by expression works differently?

       

      Screen Shot 2017-06-08 at 11.07.22 AM.png

        • Re: Color by expression
          Felip Drechsler

          Hi Monica,

           

          Not seeing your data might be a bit difficult to identify, but i would assume that for the dimension your using, the row value for the corresponding jira_ticket_number would be different from what your testing on the if statement giving you the colors presented in the pie chart..

           

          Since your trying to paint data that have values for both of the if statements (example, being null / empty or '-' and has value) it paints with only one color.

           

          Attached an example with dummy data.

           

          Make the following selections to understand what i'm saying:

          - Select status = 'Escalated to PD'

          - Select jira_ticket_number = '1,'2','-'

           

          Deselect all and individually select the jira_ticket_number = '1,'2','-' to see what happens.

           

          Felipe. !

          • Re: Color by expression
            Bella Mae

            If you expression is working you could put that in your script as a field and then you should be able to use a simple if statement in the colours tab

            e.g.

            Capture2.PNG

            if("Gender"='Male',rgb(68,119,170),if("Gender"='Female',rgb(204,102,119), rgb(253,219,102)))

            Capture3.PNG