Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
stjernvd
Partner - Creator
Partner - Creator

Errors with Red and Green background for if statement

Hi,

Depending on my if statement I would like a red and green background for the values, but when I use this equation it doesn't work, I am using this statement in the background drop down in the expressions tab in a straight table...

if(Match([Tool Entity],'Eduroam','Lse')=0,Green(),if(Match([Tool Entity],'Eduroam','Lse')<>0,Red()))

So I want for the values for fields 'Eduroam' and 'Lse' within the main field [Tool Entity] to be green when = 0 and I want them to be red when they are not equal to 0.

What am I doing wrong?

11 Replies
simenkg
Specialist
Specialist

Pick(1+Match([Tool Entity],'Eduroam','Lse'),Red(),Green(),Green())

avinashelite

try like this:

if([Tool Entity]='Eduroam' or [Tool Entity]='Lse',Green(),Red())

avinashelite

c.png

Gysbert_Wassenaar

So I want for the values for fields 'Eduroam' and 'Lse' within the main field [Tool Entity] to be green when = 0 and I want them to be red when they are not equal to 0.

Ehm... a string value 'Eduroam' is always unequal to a value 0. 'Eduroam' is a string value. Where does the 0 come from?


talk is cheap, supply exceeds demand
stjernvd
Partner - Creator
Partner - Creator
Author

Hi Simen,

Thank you for this.

How do I do it so that only the value is green or red and not the entire background? so just the number?

stjernvd
Partner - Creator
Partner - Creator
Author

Hi Gysbert,

Sorry I clearly made a mistake, these fields 'Eduroam' and 'Lse' are meant to be for the sum(position) column which is the values of the fields 'Eduroam' and 'Lse' within 'Tool Entity'.

So when 'Eduroam' and 'Lse' within TOOL ENTITY = 0, the values for sum(position) should be green, and if they are not equal to zero sum(position) values should be red.

How do I set that up?

stjernvd
Partner - Creator
Partner - Creator
Author

Hi Avinash,

Sorry I clearly made a mistake, these fields 'Eduroam' and 'Lse' are meant to be for the sum(position) column which is the values of the fields 'Eduroam' and 'Lse' within 'Tool Entity'.

So when 'Eduroam' and 'Lse' within TOOL ENTITY = 0, the values for sum(position) should be green, and if they are not equal to zero sum(position) values should be red.

How do I set that up?

Gysbert_Wassenaar

I'm afraid you're not making things clearer. I have no idea what are fields, what are expressions and what are values. Please post a small qlikview document that makes clear what's what.


talk is cheap, supply exceeds demand
stjernvd
Partner - Creator
Partner - Creator
Author

Sorry, in my straight table:

Tool Entity (Field)

Eduroam

LSE

UCL

Kings

Sum(Position) (Values)

So I only want to highlight the strings 'Eduroam' and 'Lse' as red and green within the field Tool Entity, so if sum(Position) for Eduroam and Lse = 0, I want the Sum(Position) value to be green, if sum(Position) for Eduroam and Lse <> 0, I want the Sum(Position) value to be red. I just want to highlight the number, not the entire cell background.

How do I do this?