Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
stjernvd
Partner - Creator
Partner - Creator

In a grid chart, show negative values as red?

Hello,

I would like to in my grid chart show positive values in green and negative values in red.

My values are in percentages.

So far I have been able to make them green for positive, but the negative values won't show up at all.

I entered this formula into the expression background color definition:

If(Avg(Growth)<0,RGB(Avg(Growth)=255,0,0),RGB(Avg(Growth)=0,128,0))

and I get this:

Grid Chart.PNG

How do I make the negative percentage values appear and then turn red? Is there somewhere else I should enter the formula or is there a better way to go about it than a formula?

Thanks.

6 Replies
Anonymous
Not applicable

Hi,

please can you post a Qvw example?

Is simplest to answer to you.

Giuseppe

Anonymous
Not applicable

We also have a funtion Red().

Did you tried?

stigchel
Partner - Master
Partner - Master

What are you trying to achieve with RGB(Avg(Growth)=255, as this will almost certainly always be 0 (Qlikview number representation for false, -1 for true), the color for red always becomes RGB(0,0,0) which is black.

Try

If(Avg(Growth)<0,RGB(255,0,0),RGB(0,128,0))

awhitfield
Partner - Champion
Partner - Champion

Hi,

the Background colour expression should more like:

If(Avg(Growth)<0, Red(),Green())

See Simple example attached

Andy

stjernvd
Partner - Creator
Partner - Creator
Author

Thank you Piet this works!

stigchel
Partner - Master
Partner - Master

You're welcome Danielle

If this has answered your question, can you please mark the relevant answers as Correct? It will close this thread and help others find correct answers and let contributing members know this requires no more attention.