Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

QV equivalent of Excel IF(AND() formula

Afternoon folks,


I have the following Excel IF(AND()) formula and I've tried writing it as an expression in QV, replacing the cell references for expressions where applicable. It doesn't seem to like it however.

Could someone please convert the below to an expression, and advise how you do it?

=IF(D2<=0,1,IF(AND(C2<=0,D2>0),0,IF(AND(C2>0,D2>0),1-IF(D2/C2>1,1,D2/C2),"")))

Thanks in advance,

Gareth

1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

=IF(D2<=0,1,

                    IF(C2<=0  AND D2>0,0,

                              IF(C2>0 AND D2>0,1-IF(D2/C2>1,1,D2/C2),0)))

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

7 Replies
vinieme12
Champion III
Champion III

=IF(D2<=0,1,

                    IF(C2<=0  AND D2>0,0,

                              IF(C2>0 AND D2>0,1-IF(D2/C2>1,1,D2/C2),0)))

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Anonymous
Not applicable
Author

Thanks Vineeth,


Can't believe how simple that was!

vinieme12
Champion III
Champion III

if you are coming from excel it will be easier for you to adopt QV

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
devarasu07
Master II
Master II

Hi,

Can you share your excel mock data with excel formula and expected output result column,

and condition you have try like below,

if(D2 <=0, 1,

if(c2<=0 AND D2>0,0,

if(C2>0 and D2>0,1,

1-if((D2/C2)>1,1,D2/C2),0)))

buzzy996
Master II
Master II

just and between ur two conditions instead of after if open bracket.

Beginner_Qlik
Contributor
Contributor

Hi,

I want to calculate If And function in Qliksense set analysis which is not working. For each key I will add 30.

if(Key=1 AND sum(A)<= sum({<key={$(1,)}>} Sales),Sum(A)/sum({<key={$(1)}>} Sales)*30+30,

if(Key=2 AND sum(A)<= sum({<key={$(1,2)}>} Sales),Sum(A)/sum({<key={$(1,2)}>} Sales)*30+60,0))

Its not working in set analysis

Beginner_Qlik
Contributor
Contributor

Hi

I want to calculate If And function in Qliksense set analysis which is not working. For each key I will add 30.

if(Key=1 AND sum(A)<= sum({<key={$(1,)}>} Sales),Sum(A)/sum({<key={$(1)}>} Sales)*30+30,

if(Key=2 AND sum(A)<= sum({<key={$(1,2)}>} Sales),Sum(A)/sum({<key={$(1,2)}>} Sales)*30+60,0))

Its not working in set analysis