Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Nested if Statement - 2 fields

I am trying to write a nested if statement.  I tried the following but it is not working. 

if(if([Working Status] = 'Consultant', if([Location] like'3PP*','Offshore Consultant')), 'Onshore Consultant',[Working Status])as [Consultant Location]

I need logic in my script that will do the following. 

If [Working Status] = 'Consultant' AND [Location] LIKE '3PP*' then 'Offshore Consultant'

If [Working Status] = 'Consultant' AND [Location] NOT LIKE '3PP*' then 'Onshore Consultant'

else [Working Status].

Basically I want to split my current [Working Status] value of 'Consultant' into 2 values "Onshore" vs "Offshore" using the [Location] field.

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi Steve

If([Working Status] = 'Consultant' AND wildmatch([Location],'3PP*'),'Offshore Consultant',

If([Working Status] = 'Consultant' AND not wildmatch([Location],'3PP*','Onshore Consultant',[Working Status]))

as YourField

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Hi Steve

If([Working Status] = 'Consultant' AND wildmatch([Location],'3PP*'),'Offshore Consultant',

If([Working Status] = 'Consultant' AND not wildmatch([Location],'3PP*','Onshore Consultant',[Working Status]))

as YourField

Not applicable
Author

i was also able to use the following code to get it to work

if([Working Status] = 'Consultant' and [Location] like '3PP*', 'Offshore Cons', if([Working Status]='Consultant' and not [Location] like '3PP*', 'Onshore Cons', [Working Status])) as [Working Status (location)],