Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
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
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 ur dimension

Channa
silviaherf
Contributor
Contributor

Hi there,

 

I think that the problem here is that wildmatch returns a number. So, to make your script work, you should try the following extract:

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

 

Notice that I also removed a comma that was not necessary, and that the field name cannot have "[ ]", but simple ' instead.

 

Nevertheless, you can simply use:

 

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

 

 

Hope this is useful. Regards,

 

Silvia

 

 

UdayKiran7
Contributor
Contributor

Try using 'Match' instead of ' Wildmatch' and remove the last comma.