Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Coloring table cell with IF statement

I have a similar table in Qlik Sense:

Clipboard01.jpg

I have a column for:

Physician

AVG RVU (productivity number)

Varience

What I would like to do is color the cell red or  green depending on the variance being a positive or negative change. Coloring the entire cell or just the arrow will work.

The expression for the varience is:

avg(total total_rvu)-avg(total_rvu)

Thank you in advance.

1 Solution

Accepted Solutions
chancekbarkley
Partner - Contributor III
Partner - Contributor III

Nathan, i just tried it and this worked for me.

Use this in your Expression:

if((avg(total total_rvu)-avg(total_rvu))>0,'▲','▼')

Use this for your background color:

if((avg(total total_rvu)-avg(total_rvu))>0,Green(),Red())

View solution in original post

12 Replies
Not applicable
Author

Correct me if i'm wrong. You are trying to do this in Qlikview? if so.

If its a straight table u use visual que's & use the color expression there, also u can try by giving color expression in the dimension or KPI pivot's. like in the image below.

Capture.PNG

Thanks

Brad.

Not applicable
Author

I am using Qlik Sense

Anonymous
Not applicable
Author

Are you trying to do this in Qlik Sense?

If so,you can use a straight table -> data -> background color, you can put the expression

if(varience>0, green(),red())

Best Regards

Not applicable
Author

I tried this:

if(avg(total total_rvu)-avg(total_rvu))>0,green(),red())

But I didn't get the desired results

Not applicable
Author

Hi Nathan,

Your formula is nearly there, but think it is a bracket issue, please try;

if((avg(total total_rvu)-avg(total_rvu))>0,Green(),Red())

Regards,

Jason.

chancekbarkley
Partner - Contributor III
Partner - Contributor III

Nathan,

It looks like you may have a misplaced parenthesis that is terminating the if statement prematurely.  Try this:

if(avg(total total_rvu)-avg(total_rvu)>0,green(),red())

or this:

if((avg(total total_rvu)-avg(total_rvu))>0,green(),red())

-cb

Not applicable
Author

I have it working, sort of.  I used if(((avg(total total_rvu)-avg(total_rvu)))>0,green(),red()) in the background color expression and in the normal expression.

Is there a way to display ▼/ ▲ instead of the RGB(128,0,0) ?

rvu_screen.jpg

chancekbarkley
Partner - Contributor III
Partner - Contributor III

Have you tried using the same formula and replacing Green with '▲' and red with '▼' for the expression?

Not applicable
Author

I have, that did not work, it's saying that ▼ is not a valid function