Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
joeybird
Creator III
Creator III

if statement for colour expression


Hiya

in qlik sense, I am using a Pivot table.

I am trying to write a if statement for different conditions to, change either the background colour or

I need to able able to define two conditions or 3 conditions are matched

e.g

IF(Library =  '1' and  Cafe = '0',  rgb(153,102,0),

issue I have is using the same line but in different context

IF(Library =  '1' and  QSRoom = '0',  rgb(153,102,0),.... I want this to go the same colour but it does not change

also having issues when defining 3 conditions

IF(Library =  '1' and  Cafe = '0' and QSRoom = '0',  rgb(153,102,0),

please help

1 Solution

Accepted Solutions
Not applicable

Missed the nesting:

IF(Library =  '1' and  QSRoom = '0',  rgb(0,0,0),

If((MeetingCancelled =  '1' and  MeetingReallocated = '1'),  Green(),

if(  MeetingCancelled =  '1', Yellow(),

if(  MeetingReallocated  =  '1', Green(),

if(  Library  =  '1' , Red ()

)))))

View solution in original post

8 Replies
Gysbert_Wassenaar

Can you post a Qlik Sense app that illustrates the problem? Because your description doesn't give enough information to even make a wild guess as to what could be a solution.


talk is cheap, supply exceeds demand
joeybird
Creator III
Creator III
Author

Hiya

cant sorry but ..

I trying to write something like this

IF(Library =  '1' and  QSRoom = '0',  rgb(0,0,0),

if(  MeetingCancelled =  '1', Yellow(),

if(  MeetingReallocated  =  '1', Green(), *

if(  Library  =  '1' , Red () ,

If((MeetingCancelled =  '1' and  MeetingReallocated = '1'),  Green(),  ***

)))))

issue 1 I am having is using to lines to get the same colour * works and *** does not work

issue 2 is

IF(Library =  '1' and  Cafe = '0' and QSRoom = '0',  rgb(153,102,0),

when I have 3 conditions, I get no colour

please help

Not applicable

you look to be doing a nested IF statement, but i am not sure what the * are meant to do?

If you remove them, does it work?

IF(Library =  '1' and  QSRoom = '0',  rgb(0,0,0),

if(  MeetingCancelled =  '1', Yellow(),

if(  MeetingReallocated  =  '1', Green(),

if(  Library  =  '1' , Red () ,

If((MeetingCancelled =  '1' and  MeetingReallocated = '1'),  Green())

))))

joeybird
Creator III
Creator III
Author

Hiya

the * were just to show where I think the error is this statement.

my statement already reads

as

IF(Library =  '1' and  QSRoom = '0',  rgb(0,0,0),

if(  MeetingCancelled =  '1', Yellow(),

if(  MeetingReallocated  =  '1', Green(),

if(  Library  =  '1' , Red () ,

If((MeetingCancelled =  '1' and  MeetingReallocated = '1'),  Green())

))))

but I cant get the two areas to go green()

please help


Not applicable

ahhhh!

the order of your IF statements is the problem

IF(Library =  '1' and  QSRoom = '0',  rgb(0,0,0),

If((MeetingCancelled =  '1' and  MeetingReallocated = '1'),  Green())

if(  MeetingCancelled =  '1', Yellow(),

if(  MeetingReallocated  =  '1', Green(),

if(  Library  =  '1' , Red () ,

))))

joeybird
Creator III
Creator III
Author

Hiya

no sorry problem still remains.

just tried this on its own

If((MeetingCancelled =  '1' and  MeetingReallocated = '1'),  Green())

and it don't work

please help

Not applicable

Missed the nesting:

IF(Library =  '1' and  QSRoom = '0',  rgb(0,0,0),

If((MeetingCancelled =  '1' and  MeetingReallocated = '1'),  Green(),

if(  MeetingCancelled =  '1', Yellow(),

if(  MeetingReallocated  =  '1', Green(),

if(  Library  =  '1' , Red ()

)))))

joeybird
Creator III
Creator III
Author

Hiya

thank you x it worked