Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
livio218526
Creator
Creator

Nested IF with AND operator in Qlik Sense

Hi everyone,

i have a problem when i try to create a new calculated field by using a Nested IF.

For example I have a Field Age and I want create a new Field (Color) with 'A' if Age > 10 and < 20, 'B' if Age >=20 and < 40 and so on...

I try to create this function but Qlik show me this error: missing right parenthesis:


if(Age > 10 and Age < 20,A,

7 if(Age >= 20 and Age < 40,B,))

Thanks,

Livio

36 Replies
Anil_Babu_Samineni

That's impossible. Because, The functionality is same for Script / UI.

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
prma7799
Master III
Master III

What error you are getting ...

If possible please share error screen or sample app.

prma7799
Master III
Master III

or use [City Code]  instead of City Code

livio218526
Creator
Creator
Author

Hi, I try but in the Data Manager Qlik show me that missing right parenthesis. I don't understand

prma7799
Master III
Master III

if(City Code>=10 and City Code <=20   ,Green(),

if(City Code >20 ,Blue(),

if(City Code >0 and City Code <10 ,Black(),

rgb(255,0,0))) )

this is work for me please share your sample file

livio218526
Creator
Creator
Author

Untitled.jpg

No, I see the same error again

prma7799
Master III
Master III

Please share sample file ...

livio218526
Creator
Creator
Author

How i can share you the fiels?

prma7799
Master III
Master III

Please check this

Uploading a Sample

livio218526
Creator
Creator
Author

Qlik send me this error if i try to upload the file:


You are not allowed to create or update this content


However i've a simple xls with a field "City Code", by using this i want to create a new field like "PROVA" with the script:


if ([City Code] > 10 AND [City Code] < 50, 'HELLO',

if([City Code] >= 50 AND [City Code] < 100, 'WORLD', 'OTHERS'))

prma7799