Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

joeybird
Contributor II

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

Re: if statement for colour expression

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 ()

)))))

8 Replies

Re: if statement for colour expression

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
Contributor II

Re: if statement for colour expression

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

Re: if statement for colour expression

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
Contributor II

Re: if statement for colour expression

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

Re: if statement for colour expression

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
Contributor II

Re: if statement for colour expression

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

Re: if statement for colour expression

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
Contributor II

Re: if statement for colour expression

Hiya

thank you x it worked


Community Browser