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: 
Anonymous
Not applicable

If statement with And condition

I'm trying to create a Calculated field based on the Account number within some certain range of accounts.

The expression created as below, but show error. Please correct me if I used wrong expression.

If([LEDGERBALANCESDIM.ACCOUNTNUM]>='500000' and [LEDGERBALANCESDIM.ACCOUNTNUM]<='599999','COST OF SALES','OTHERS')

9 Replies
mdmukramali
Specialist III
Specialist III

HI Yusuf,

it seem expression looking fine.

can you share the sample app.

Thanks,

Mukram.

Anonymous
Not applicable
Author

how can i share?

mdmukramali
Specialist III
Specialist III

Hi Yusuf,

Click on Reply ---> Use Advanced Editor  --> Attach

282226.PNG

282226_1.PNG

Anonymous
Not applicable
Author

Sorry, I don't find Advanced Editor in my reply function, even though app having some confidentiality data which can make problem for me.

Expecting your understandingIfAndCondition.jpg 

mdmukramali
Specialist III
Specialist III

I created a Dimension with similar condition which is working fine without any error .

259155.PNG

Anonymous
Not applicable
Author

Dear, I do the same except the = sign (not accepting in calculated field). as below

If([LEDGERBALANCESDIM.ACCOUNTNUM]>=400000 and [LEDGERBALANCESDIM.ACCOUNTNUM]<=499999,'True','False'), but still showing error, closing paranthesis with red error underline as indiacted.IfAndCondition.jpg

Anonymous
Not applicable
Author

Hi,

  It looks like the "AND" is not considered in your expression. Can you re check your function selection or try create a field in the script level.

-Jai

Anonymous
Not applicable
Author

Yes, you are right, the same expression working in Script editor not working with create field level expression. even though while defining the expression in the expression box 'and' function is not showing. May be Qlik need to review the loaded function.

Thanks for your input and works well in Data Load editor.

Anonymous
Not applicable
Author

Thanks all, working in Data Load Editor script not working in Field level expression.