Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
MK9885
Master II
Master II

Multiple IF Condition

Hi,

I've been trying to implement multiple IF condition.

I've achieved it when I had 2 if's now I need to add 3rd if which can also be done but the problem is it's range based.

Ex:

if($(v123)>=1000000,'A',

if($(v123)<=100000,'B'))


Now I want the result if 123 is >1000000 as A

If 123 is < 100000 as B

and if 123 is in between 1 and 99999 as C

Basically it is in between a particular number

Ex:between 1 to 100 is A, between 100 to 1000 is B and greater than or equal to 10000 is C


Thanks.

@

stalwar1

vinieme12

27 Replies
MK9885
Master II
Master II
Author

Sorry to say but I've tried this as well and it gives me 0.00 M for values in thousands and for values in M it is giving 1.00 M for everything.

sunny_talwar

Would you be able to share a sample where this isn't working?

MK9885
Master II
Master II
Author

Thanks but I've tried all the suggestions given here and sadly none is working....

MK9885
Master II
Master II
Author

Sorry I cannot.

A. This application is quite big in size.

B. The stored variable has 9 line expression in it and using 15 different dimensions.

cannot create a sample for this.

sunny_talwar

Create a dummy app where you can replicate the issue because if you are not able to share, we won't know what might be going wrong.... because in general it should work

vinieme12
Champion III
Champion III

intead of using Num() to format have you tried formatting it as Money? and then assign Symbols for Thousand/Million/billion? on the Number tab?

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
stiffi88
Partner - Contributor III
Partner - Contributor III

=if($(Variable) >= 1 and  $(Variable)<= 100, A, if($(Variable)>=101 and $(Variable) <=1000, B ,if($(Variable)>=1001 and $(Variable) <=10000, C,'NotMatched')))

stabben23
Partner - Master
Partner - Master

=if($(Variable)>=1000000000 ,num($(Variable)/1000000000, '$#,##0.00 B'),

if($(Variable)<=10000000000 ,num($(Variable)/10000000, '$#,##0.00 M'),

if($(Variable)<1000000000 ,num($(Variable)/10000000, '$#,##0.00 K'))))

here, if a value is 999999999, both M and K will be true. Qlikview Choose M

MK9885
Master II
Master II
Author

Yes I agree.

Is there a function to look for in between values?

Like if 1 to 100 A

<1000 to 99 as B

and > 1000 as C

Something like this?

When I use the above expression, it gives me 0.00 M for values in thousands.

Anonymous
Not applicable

arvind,

There have been a lot of good responses that should work.

If it still doesn't, I'm inclined to think the issue is tied to your data values.  Can you validate the value of your variable when you run the script in debug mode?