Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Function "if" calculate in then

Hi guys,

I don't understand How I can calculate some examples. See below.

if (a>0, 'b*0,1', 'b*0,15')

I see result b*0,1, but I want calculate it. For example 3*0,1 and result = 0,3.

How I can do it? Help me, please.

Many thanks,

Yuriy

1 Solution

Accepted Solutions
avinashelite

Whats the condition your looking for ? could you please explain bit more

if(a>0 , b*0.1 , b*0.15 )

so this evaluate like this ....

if a >0 , then b multiple 0.1 and if a not >0 then b multiple 0.15

Hope this helps you

View solution in original post

8 Replies
oknotsen
Master III
Master III

Remove the quotes.

Replace the comma by a dot. Only a hand full of countries use the comma as a decimal separator, the rest of the world (or at least the programming world) uses a dot. Confusing, I know; I live in a country that uses the comma.

May you live in interesting times!
avinashelite

here is an example

if(condition , then , else)

The three parameters condition, then and else are all expressions. The first one, condition, is interpreted logically. The two other ones, then and else, can be of any type. They should preferably be of the same type. If condition is true, the function returns the value of the expression then. If condition is false, the function returns the value of the expression else.

Example:

if( Amount>= 0, 'OK', 'Alarm' )

Not applicable
Author

Thanks, but it doesn't work.

I have the same result b*0.1, but I want receive 0.3 (b*0.1=3*0.1).

Have you any another ideas?

avinashelite

Whats the condition your looking for ? could you please explain bit more

if(a>0 , b*0.1 , b*0.15 )

so this evaluate like this ....

if a >0 , then b multiple 0.1 and if a not >0 then b multiple 0.15

Hope this helps you

Not applicable
Author

Thank you a lot! It works.

Many thanks,

Yuriy

oknotsen
Master III
Master III

So what I suggest does not work, but when Avinash suggests (in my opinion) exactly the same it does all of a sudden work?

Could you explain the difference as I am probably overlooking the obvious.

May you live in interesting times!
avinashelite

okg‌ probably the example made a difference but yes yours and mine suggestion are one and the same

Not applicable
Author

Yes, of course. Example help me. I was careless and forgot remove quotes, that's why I had a negative result(((

Of course, you answer is right and the same.

Sorry for my careless. Thank you for help.