Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

vpanchuda
New Contributor

Multiple If and Statements after checking

ComplianceApprovalindicatorApproval date
   
N/AYes 
N/AYes 
N/ANO01-01-2019
N/ANO 
N/ANO 

 

IF(Compliance='N/A' AND ApprovalIndicator='true','Approved N/A',
iF(Compliance='N/A'AND ApprovalIndicator='false','Not Approved N/A',


Compliance))) as CalculatedCompliance,

 

In the above table, I have coded the above syntax and works fine, I also have to add one more if in the same loop for the below condition, not able to get the syntax.

iF(Compliance='N/A' AND ApprovalIndicator='false',  and [here i have to check if anything  is entered in this cell it can be date or any string in Approvaldate field  ) 'Approved N/A',

Can anyone help me with syntax, please?? ie

if Compliance =N/A and

ApprovalID=NO and

if any value is present in the Approval date column then it should return 'Approved N/A' (this could be number or string in the cell)

 

1 Solution

Accepted Solutions
zzyjordan
Contributor II

Re: Multiple If and Statements after checking

Hi, there

try this

IF(Compliiance='N/A' AND Approvalindicator='Yes','Approved N/A',
IF(Compliiance='N/A'AND Approvalindicator='No' and (Not isnull("Approval Date")),'Approved N/A',
iF(Compliiance='N/A'AND Approvalindicator='No','Not Approved N/A',Compliiance)
)
) as calc

aa.JPG

ZZ

4 Replies
Highlighted
Mauritz_SA
Contributor III

Re: Multiple If and Statements after checking

Hi there

You can add Len(Trim([Approval date])). Len looks at how many characters there is in the field and trim removes all the spaces. It will return 0 if the cell is completely empty or only has spaces and a number greater than 0 if there is anything at all. So your condition will be Len(Trim([Approval date]))>0 in your if statement. For example:

iF(Compliance='N/A' AND ApprovalIndicator='false'  AND Len(Trim([Approval date]))>0, <True result>,<False result>)

Good luck,

Mauritz

zzyjordan
Contributor II

Re: Multiple If and Statements after checking

Hi, there

try this

IF(Compliiance='N/A' AND Approvalindicator='Yes','Approved N/A',
IF(Compliiance='N/A'AND Approvalindicator='No' and (Not isnull("Approval Date")),'Approved N/A',
iF(Compliiance='N/A'AND Approvalindicator='No','Not Approved N/A',Compliiance)
)
) as calc

aa.JPG

ZZ

vpanchuda
New Contributor

Re: Multiple If and Statements after checking

THank you ,I tried with alt function and it worked (but i shall try with this as well a different approch though)
vpanchuda
New Contributor

Re: Multiple If and Statements after checking

This worked , I even used the alt function and that also worked .