Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Need to nested if condition replace with pick match function

I am working on table. I have table Like -

ApplicableReportedResult
YYYes
YNNot Applicable
NNNA

I have done this issues using the "Nested If" condition.

like -

If(Applicable='Y' and Reported='Y', 'Yes'

    ,if(Applicable='Y' and Reported='N', 'Not Applicable'

    ,If(Applicable='N' and Applicable='N', 'NA'))) as "Result"

but I want to do this using the "Pick and Match function" because there is two condition (Applicable and Reported). how it possible.

Please help.

6 Replies
gerry_hdm
Creator II
Creator II

i dont understand your Problem

result not in " " Setting and you become this table !

myIF:
load * Inline [
Applicable, Reported, ResultSoll
Y, Y, Yes
Y ,N, Not Applicable
N, N, NA
]
;
EndeFile:
load *,
If(Applicable='Y' and Reported='Y', 'Yes'
,
if(Applicable='Y' and Reported='N', 'Not Applicable'
,
If(Applicable='N' and Applicable='N', 'NA'))) as Result
resident myIF;

drop Table myIF;

Anonymous
Not applicable
Author

Hi Gerold Roser

my question is 

Result = "Yes",  if Applicable = "Y" and Reported = "Y"

Result = "Not Applicable" ,  If Applicable  ="Y" and Reported = "N"

Result  = "NA" , If Applicable  =  "N" and Reported = "N".

I have done this issues with Nested If Condition. but I want to do this issues with "Pick and Match" function.

gerry_hdm
Creator II
Creator II

undergrinder
Specialist II
Specialist II

Hi Sushant,

If these are the only possible states, then try this expression:

=pick(match('N',Applicable,Reported)+1,'Yes','NA','Not Applicable')

It assumes when Applicable='N' then the Reported field is also 'N'

G.

undergrinder
Specialist II
Specialist II

and don't manage that situation, when one of the fields is null

MarcoWedel

Hi,

another solution might be:

QlikCommunity_Thread_309934_Pic1.JPG

table1:

LOAD Applicable,

    Reported, 

    Pick(Match(Applicable&'/'&Reported,

          'N/N' , 'N/Y'       , 'Y/N'            , 'Y/Y'),

          'NA'  , 'undefined' , 'Not Applicable' , 'Yes'

        ) as Result

FROM [https://community.qlik.com/thread/309934] (html, codepage is 1252, embedded labels, table is @1);

hope this helps

regards

Marco