Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Joaquin-Vergara
Contributor II
Contributor II

Coloring a pie chart using an expression

Hi, I am trying to use custom colors in a pie chart in QlikSense, however, the entire pie chart is using the last color in my expression, independently if they meet the criteria or not. You can the details for my pie chart below:

Measure: Count({$<[Responsible Party]={'Company','Customer','Third Party'}>}[SNOW#])

Colors and Legend > By Expression (This expression is a color code CHECKED).

Color Expression: 

if(
wildmatch([Responsible Party],'Company'),
rgb(28,78,128),
if(
wildmatch([Responsible Party],'Customer'),
rgb(234,106,71),
rgb(165,216,221),
)
)

Despite this, it is coloring my entire pie chart to the last color indicated [(165,216,221)] as seen on the below screenshot:

piechart.png

 

QlikSense version: February 2018 Patch 1 (qliksense server: 12.5.3)

Would appreciate some assistance. Thank you!

Labels (3)
12 Replies
Joaquin-Vergara
Contributor II
Contributor II
Author

And to add to this.. I just tried the same color expression on a bar chart that displays the same data, and it worked... However, I need to be able to color both graphs. 

 

lironbaram
Partner - Master III
Partner - Master III

hi

do you use [Responsible Party] as dimension

if so when you use color by dimension do you get different color for each value ?

 

Joaquin-Vergara
Contributor II
Contributor II
Author

That is correct. I use [Responsible Party] as dimension and if I select Color by Dimension, a color is assigned to each value as intended. See below:

piechart2.png

lironbaram
Partner - Master III
Partner - Master III

strange 

just checked it in my server and it works ok 

can you share a picture of your color settings 

Joaquin-Vergara
Contributor II
Contributor II
Author

Not sure if this is what you mean:

colorpiechart.pngexpression.png

lironbaram
Partner - Master III
Partner - Master III

Hi 

try to delete the last comma sign,
it's not needed 

Joaquin-Vergara
Contributor II
Contributor II
Author

Hi, thanks for bringing that up, I corrected it. However, it is still not coloring the pie chart.

lironbaram
Partner - Master III
Partner - Master III

Hi 

can you share a sample data , for example the data behind the chart which is meaning less , 

other way to check will be to create a table and put the color expression as measure and the same dimension , to see the results the function brings back 

Channa
Specialist III
Specialist III

=if(DECLARATION_TYPE_EN='IMPORT','#8d1b3d',if(DECLARATION_TYPE_EN='EXPORT','#693c26',if(DECLARATION_TYPE_EN='Re-Export','#d96226',if(DECLARATION_TYPE_EN='Temporary Import','#fd9917'))))

 

i use this it works 

try to replace 

Channa