Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Color by expression

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

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

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

View solution in original post

3 Replies
felipedl
Partner - Specialist III
Partner - Specialist III

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. !

Anonymous
Not applicable
Author

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

Not applicable
Author

Hi Bella,

This helped, I moved the if statement to my script and called on the fields with another if statement.

Thank you for the tip.