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

If value AND value OR value, then...

Hey guys,

Question concerning conditional formatting in Qlikview.

3 Dimension:

Type_one= a, b, c

Type_two= x, xx, xxx, y, yy, z, zz, zzz

Order: those are order numbers: eg. 123, 111, 222, 333, 444, ...

I am using the formatting option on the dimension of "order" (background color)

I want to make the background of "order" red when:

=if((Type_one='a' AND Type_two='x*' , rgb(231,0,24))

Using the * does not work for some reason.

So I tried something else and I listed all the values:

=if((Type_one='a' AND Type_two='x' OR 'xx' OR 'xxx' , rgb(231,0,24))

It does work with this formula, but it only turn the background of "x" red, it ignores everything else that comes after the "OR's"

How can I fix this?

Thank you!

8 Replies
er_mohit
Master II
Master II

Try this

=if(Type_one='a' AND Type_two='x' OR Type_two='xx' OR Type_two='xxx' , rgb(231,0,24))

or

=if(Type_one='a' AND  wildmatch(Type_two,'x*') , rgb(231,0,24))

kumarnatarajan
Partner - Specialist
Partner - Specialist

Hi,

Try this.

if(Only({1}Type_one)='a' AND  wildmatch(Only({1}Type_two),'x*') , rgb(231,0,24))

Not applicable
Author

=if(Type_one='a' AND Type_two=pick(wildmatch(Type_two,'x*'),'x*') , rgb(231,0,24))

Not applicable
Author

Thanks to all!

What a quick service!

Small remark though,

How can I turn everything red that does NOT contain 'x*'

Using this one:

=if(Type_one='a' AND  wildmatch(Type_two,'x*') , rgb(231,0,24))

Thx!

er_mohit
Master II
Master II

if(Type_one='a' AND  wildmatch(Type_two,'x*') , rgb(231,0,24),lightred())

hope it helps

Not applicable
Author

No that does not work, you are using two different types of red now.

But I found a solution, white as the first result and red as the second.

er.mohit wrote:

if(Type_one='a' AND  wildmatch(Type_two,'x*') , white, red)

hope it helps

But that is not really what I was looking for, I was hoping to use something like '<> x*' in the formula.

Do you have any idea?

_________

And how do I get the following two parts into one function:

if(Type_one='a' AND  wildmatch(Type_two,'x*') , white, red)


if(Type_one='b' AND  wildmatch(Type_two,'x*') , red, white)

In the first one it is good to have x in the values. So everything without x needs to be red.

In the other one it is bad to have x in the values. So everything with x needs to be red.

er_mohit
Master II
Master II

if(Type_one='a' AND  Type_two<>'x*'  rgb(231,0,24))

if(Type_one='b' AND  Type_two='x*'  rgb(231,0,24))

hope it helps you


Not applicable
Author

Hey er.mohit,

No that one does not work unfortunately.. Looks like from the second you try to use a * in the formula, it needs a (wildmatch).

Because your formula with "<>" does work, bot only if I look for 'x', not for 'x*'.