Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
ioannagr
Creator III
Creator III

Problem with dual if operators

Hello everyone.

 

I seem to be facing an issue regarding "dual if" expression. So I have two variables, systolicpressure and diastolicpressure and I want to combine them in order to create categories for bloodpressure.

What I type is :

If(systolicpressure<=120 and diastolicpressure<=80,"normal",
If((systolicpressure>120 and systolicpressure<=129) and (diastolicpressure<=80),"elevated",
If((systolicpressure>=130 and systolicpressure<=139) or (diastolicpressure>80 and diastolicpressure<=89),"high blood pressure- hypertension stage 1",
If((systolicpressure>=140 and systolicpressure<180) or (diastolicpressure>=90 and diastolicpressure<120),"high blood pressure- hypertension stage 2",
If(systolicpressure>=180 and diastolicpressure>=120,"hypertensive crisis",
If(systolicpressure>=180 or diastolicpressure>=120,"hypertensive crisis", "null"))))))

 

I get the message: "missing right parenthesis" but this is not the case I believe; I tried a shorter version of this expression and it worked perfectly, but when the operator comes in I get error messages.

 

What am I doing wrong? Any help is appreciated.

 

Thank you,

Ioanna

Labels (3)
12 Replies
Gysbert_Wassenaar

Instead of:

If(systolicpressure<=120 AND diastolicpressure<=80
, 'normal'
, ...
)

You write:

If(systolicpressure<=120
, If (diastolicpressure<=80
, 'normal'
, ...
)
)

A lot more work, but the Data manager can handle nested ifs and it can't handle multiple conditions in an if statement.

talk is cheap, supply exceeds demand
ioannagr
Creator III
Creator III
Author

I see.

Do you know how I need to treat the "or" operator that way?

Gysbert_Wassenaar

You don't want to go there. Accept that the Data manager is broken and use the Data load editor instead.

Or create the calculated field in the source data.


talk is cheap, supply exceeds demand