Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
RageQlik
Contributor
Contributor

IF And expression

Good Afternoon,

total novice user with probably an even more novice question... How do you use the "and" function in Qlik. My expression is below;

IF([plantype]='Managed Service','Managed Service',
IF([plantype]='Pre Sales','Pre Sales',
IF([plantype]='Service Desk','Service Desk',
IF([plantype]='Product', 'Product',
IF([Customer]='Internal' and [Task]='Horizon Programme','Horizon',
IF([Customer]='Internal','Departmental',
IF([Customer]='Multiple','Departmental',
IF([Customer]='Standard Activity','Standard Activity',
IF([financialbudget]='Overhead','Customer NonBillable',
IF([financialbudget]='Maintenance & Support','Service Desk',
IF([Task]='Unassigned to Work (Enter Remarks)','Unassigned','Customer Billable')))))))))))

I have tried taking this straight from Excel "If(And(" approach which as expected didn't work. However I have tried both replacing the comma in the bold line of text with both "and" and "&&" and I can still not get anything to return as "missing right parenthesis"

Finding it a little frustrating to say the least as there are so many examples of people asking this question and nearly every answer is telling them to achieve what they want in a different way... all of which made sense to be fair, but not helpful in providing me with any insight.

Any help would be greatly appreciated.

 

TIA

7 Replies
sunny_talwar

Are you looking to check if Task = Horizon Programme or Task = Horizon? Is this what you want?

bramkn
Partner - Specialist
Partner - Specialist

please check the function pick() and match() combined to be pick(match()). it would save you from a lot of those if's use the match+1 to get a default value where u can use a pick(match()) again to check a different field next. then use another pick(match()) at the pick for internal to see if task is horizon programme.
RageQlik
Contributor
Contributor
Author

IF([Customer]='Internal' and [Task]='Horizon Programme','Horizon',

so what this should be checking is if the customer = internal and the task = horizon programme then the outcome of the expression should be Horizon.

Channa
Specialist III
Specialist III

You need to use pick and match for multiple values 

 

Channa
RageQlik
Contributor
Contributor
Author

all of the examples I have found are only showing this working if all of the matches are in the same column. additionally, I haven't seen any with multiple criteria for the same return. have you any examples of a basic query with matches being found in more than one column and also including an example of the "and" expression (or whatever works with Pick(Match()) best).

 

Thanks

RageQlik
Contributor
Contributor
Author

Having reviewed some more articles on this site it appears that "and"/ "&&" are not functions that can be used in a calculated field. having removed the and section of the expression has worked. this is still however in the nested if statement I have shared above. I do want to understand the pick match functions better so will try and get it working like that.

Thanks for your help

sunny_talwar

Two things:

1) Where exactly are you trying to use this? Front end? Back end? If Front end, then which kind of object?

2) Would you be able to share a sample where we can see the issue?