Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
karthik_nataraj
Contributor II
Contributor II

If statement Error(Missing right parenthesis)

Hello All!

I am creating a calculated field using the below if statement to create additional column in my file

if((OPSN_PLANNED_QUANTITY=1 and OPSN_COMPLETED_QUANTITY=0 and OPSN_REJECTED_QUANTITY=0 and OPSD_PLANNED_START_DATE and OPSD_PLANNED_CLOSED_DATE and OPSD_START_DATE),
 'Operation Active',
   
 if((OPSN_PLANNED_QUANTITY=1 and OPSN_COMPLETED_QUANTITY=0 and OPSN_REJECTED_QUANTITY=0 and OPSD_PLANNED_START_DATE and OPSD_PLANNED_CLOSED_DATE),
     'Operation Planned',

when I use single condition the function is working, but as i added one more condition to it, there is error:

Missing right parenthesis.

6 Replies
Vegar
MVP
MVP

You are missing right parentheses. Try this :

IF( (OPSN_PLANNED_QUANTITY=1 and OPSN_COMPLETED_QUANTITY=0 and OPSN_REJECTED_QUANTITY=0 and OPSD_PLANNED_START_DATE and OPSD_PLANNED_CLOSED_DATE and OPSD_START_DATE),

 'Operation Active',

 IF( (OPSN_PLANNED_QUANTITY=1 and OPSN_COMPLETED_QUANTITY=0 and OPSN_REJECTED_QUANTITY=0 and OPSD_PLANNED_START_DATE and OPSD_PLANNED_CLOSED_DATE),

     'Operation Planned',

Null() )) 

karthik_nataraj
Contributor II
Contributor II
Author

Hi!

Thanks for the reply,

I tried the above code, but it is giving 'Incomplete visualization' Error

 
MayilVahanan

HI @karthik_nataraj 

Instead of & symbol, please use the "AND" word .

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
karthik_nataraj
Contributor II
Contributor II
Author

Hi Mahil,

If I use "AND" I am getting 'Missing right parenthesis error'

Error.JPG

QFabian
Specialist III
Specialist III

Hi, i just took off  a couple of parenthesis and works fine : 



Load
IF(
OPSN_PLANNED_QUANTITY=1 and
OPSN_COMPLETED_QUANTITY=0 and
OPSN_REJECTED_QUANTITY=0 and
OPSD_PLANNED_START_DATE and
OPSD_PLANNED_CLOSED_DATE and
OPSD_START_DATE,

'Operation Active',

IF( OPSN_PLANNED_QUANTITY=1 and
OPSN_COMPLETED_QUANTITY=0 and
OPSN_REJECTED_QUANTITY=0 and
OPSD_PLANNED_START_DATE and
OPSD_PLANNED_CLOSED_DATE,

'Operation Planned',

Null()))

QFabian
karthik_nataraj
Contributor II
Contributor II
Author

Hello!

I tried the above if statement,

It is working fine for Add expression in analyze sheet but if I do the same in the table as Add calculated field it is giving an error.

AttachedError.JPG the screenshot for the same.