Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Color in Expression

Newbie here working on an expression in a table. If I want the Yes to be colored green, the No to be colored red, and the N/A to be colored yellow, how do I adjust the below expression?

If(Column(1) < Column(2),
'YES',

if(Column(1) > Column(2),
'NO',

if (column(1) = column(2),
'N/A'

)))

Thanks,

Ale

4 Replies
adityaakshaya
Creator III
Creator III

Hi Ale,

You can use the same expression with little change in the background color for the expression. Below is the change for your reference.

Capture_312018.PNGIf(Column(1) < Column(2),
RGB(0,255,0),

if(Column(1) > Column(2),
RGB(255,0,0),

if (column(1) = column(2),
RGB(255,0,255)

)))

Anonymous
Not applicable
Author

I still need the text "Yes", "No", or "NA" to show up plus background color. How would you edit the expression to include both color and text?

adityaakshaya
Creator III
Creator III

Hi Ale,

Follow the below steps:

Step1:

In the expression definition, you include below expression

If(Column(1) < Column(2),
'YES',

if(Column(1) > Column(2),
'NO',

if (column(1) = column(2),
'N/A'

)))

Step2:

In the left Pane of expression tab, expand the expression as shown in the below snapshot and click the background color and under itsCapture_312018.PNG definition write this

If(Column(1) < Column(2),
RGB(0,255,0),

if(Column(1) > Column(2),
RGB(255,0,0),

if (column(1) = column(2),
RGB(255,0,255)

))).

This will give you text and color both.

Thanks.

Anonymous
Not applicable
Author

Thank you Akshaya! I don't have the exact same view as you while editing the table. But was able to adjust the background color using the expression you provided. I appreciate your help.