Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
amr_qlik
Contributor
Contributor

Conditional Coloring

I'm trying to find a way to color the output of an if statement.  The function I'm using is below:

if((count(distinct{$ <[Fiscal Year] = {$(=MAX([Fiscal Year]))}>}[Product Number]) -count(distinct{$ <[Fiscal Year] = {$(=MIN([Fiscal Year]))}>}[Product Number])) > 0, '▲', '▼')

I'm wanting the upward carrot to be green and the downward carrot to be red.   I attempted to encase them in Red() and Green() but then it showed up a large number instead of a red/green carrot.

Labels (1)
8 Replies
Aditya_Chitale
Specialist
Specialist

Hi @amr_qlik ,

Add this expression in text color expression of your measure:

if((count(distinct{$ <[Fiscal Year] = {$(=MAX([Fiscal Year]))}>}[Product Number]) -count(distinct{$ <[Fiscal Year] = {$(=MIN([Fiscal Year]))}>}[Product Number])) > 0, lightgreen() ,lightred() )

 

Regards,

Aditya

amr_qlik
Contributor
Contributor
Author

I'm not seeing a text color expression box anywhere.

MarcoWedel

where do you apply this expression, i.e. what kind of object would you like to present this coloured symbol?

 

amr_qlik
Contributor
Contributor
Author

Currently, the object is in a KPI.    I'm open to it being in another object if necessary, but only if it can be made large enough to be easily seen.

MarcoWedel

At least the ▼ character might be replaced by the inherently red unicode symbol 🔻
using Chr(128315) or '🔻' instead of  '▼' in your expression.
There doesn't seem to be a green ▲ though...

MarcoWedel

Defining the colours should be possible in the Appearance/Color section.

amr_qlik
Contributor
Contributor
Author

Thank you.  Chr(128315) combined with coloring the output green gets me where I want to be!

Is there a list of the available chr() characters somewhere I could look at?

chris_djih
Creator III
Creator III

You can make this list by yourself:

Symbols:
    Load
      Chr(RecNo()) as AsciiAlpha,
      RecNo() as AsciiNum
    autogenerate 20000
   Where (RecNo()>=32  and RecNo()<=126) or (RecNo()>=160 and RecNo()<=13000)
;

Emojis:
    Load
      Chr(RecNo()) 			as EmojiAlpha,
      RecNo() 				as ENum,
    autogenerate 130000
   Where (RecNo()>=127744  and RecNo()<=128317) 
   	  or (RecNo()>=128506  and RecNo()<=128591) 
      or (RecNo()>=128640  and RecNo()<=128709)
      or (RecNo()>=128752  and RecNo()<=128762)
;

 

If you found help, mark the correct answer and give some likes to ALL contributors, that tried to help.