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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
ranjan_poojary
Contributor II
Contributor II

If..Else condition issue

Dear All,

I have an issue in my project where I have total 10 values in a particular field.Based on this field i need to create 2 values where in 1st value will contain 5 records and 2nd value will contain all 10 records,which includes 5 records of the 1st value as well.Kindly let me know how to handle this situation.I tried using IF.....Else but it does`nt work as required.

My code Sample:

If(WildMatch(FINANCE_LOB, 'MOTOR-2W','MOTOR-4W','MOTOR-GCV','MOTOR-MISC','MOTOR-PCV'), 'Motor - OD',

       If(WildMatch(FINANCE_LOB,'MOTOR-2W','MOTOR-4W','MOTOR-GCV','MOTOR-MISC','MOTOR-PCV','MOTOR-STANDALONE -                                                     2W','MOTOR-STANDALONE - CV','MOTOR-STANDALONE - MISC', 'MOTOR-STANDALONE -                                                   MISC','MOTOR-STANDALONE - PVT'), 'Motor - TP')) AS Finance_LOB_New

Eagerly waiting for your help !!! Thank you...

Kind Regards,

Ranjan Poojary

1 Solution

Accepted Solutions
ranjan_poojary
Contributor II
Contributor II
Author

Dear All,

Thank you very much for your valuable suggestions and ideas.

I resolved this issue by mapping Motor-OD and Motor-TP according to their corresponding values in Finance_LOB field.

Excel sample for your reference is given below :

  

FINANCE_LOBFINANCE_LOB_F_U
MOTOR-2WMotor - OD
MOTOR-4WMotor - OD
MOTOR-GCVMotor - OD
MOTOR-MISCMotor - OD
MOTOR-PCVMotor - OD
MOTOR-2WMotor - TP
MOTOR-4WMotor - TP
MOTOR-GCVMotor - TP
MOTOR-MISCMotor - TP
MOTOR-PCVMotor - TP
MOTOR-STANDALONE - 2WMotor - TP
MOTOR-STANDALONE - CVMotor - TP
MOTOR-STANDALONE - PVTMotor - TP
MOTOR-STANDALONE -MISCMotor - TP
MOTOR-STANDALONE - MISCMotor - TP

Thank you once again...

Kind Regards,

Ranjan Poojary

View solution in original post

5 Replies
Chanty4u
MVP
MVP

ddi u try this enclosing in  [MOTOR-STANDALONE - MISC]  

maximum wit two words u can include in []  braces and give a try

Clever_Anjos
Employee
Employee

I would use a mapping table ApplyMap ‒ QlikView

Not applicable

Dear Ranjan,

let´s think about using your if-statement:

If the field FINANCE_LOB contains the value "MOTOR-2W", then both the if and else condition are satisfied, i.e. which value should be assigned to the field?

What is the purpose of assigning the same value for all 10 possible values of your field?

Please elaborate the purpose of it. Judging from what you gave us, I guess it would be best if you simply use the first if condition only. Then you write

If(WildMatch(FINANCE_LOB, 'MOTOR-2W','MOTOR-4W','MOTOR-GCV','MOTOR-MISC','MOTOR-PCV'), 'Motor - OD', 'MOTOR-TP') AS Finance_LOB_New

Regards,

Max

swuehl
MVP
MVP

You can't have this using the same number of records, you would need to create a table that shows 5 records for your first new value, then 10 records for your second:

LINK:

LOAD

     'Motor - OD' as Finance_LOB_New,

     FINANCE_LOB

RESIDENT YourTable

WHERE  WildMatch(FINANCE_LOB, 'MOTOR-2W','MOTOR-4W','MOTOR-GCV','MOTOR-MISC','MOTOR-PCV');

CONCATENATE (LINK)

LOAD

     'Motor - TP' as Finance_LOB_New,

     FINANCE_LOB

RESIDENT YourTable

WHERE WildMatch(FINANCE_LOB,'MOTOR-2W','MOTOR-4W','MOTOR-GCV','MOTOR-MISC','MOTOR-PCV','MOTOR-STANDALONE -                                                     2W','MOTOR-STANDALONE - CV','MOTOR-STANDALONE - MISC', 'MOTOR-STANDALONE -                                                   MISC','MOTOR-STANDALONE - PVT');

ranjan_poojary
Contributor II
Contributor II
Author

Dear All,

Thank you very much for your valuable suggestions and ideas.

I resolved this issue by mapping Motor-OD and Motor-TP according to their corresponding values in Finance_LOB field.

Excel sample for your reference is given below :

  

FINANCE_LOBFINANCE_LOB_F_U
MOTOR-2WMotor - OD
MOTOR-4WMotor - OD
MOTOR-GCVMotor - OD
MOTOR-MISCMotor - OD
MOTOR-PCVMotor - OD
MOTOR-2WMotor - TP
MOTOR-4WMotor - TP
MOTOR-GCVMotor - TP
MOTOR-MISCMotor - TP
MOTOR-PCVMotor - TP
MOTOR-STANDALONE - 2WMotor - TP
MOTOR-STANDALONE - CVMotor - TP
MOTOR-STANDALONE - PVTMotor - TP
MOTOR-STANDALONE -MISCMotor - TP
MOTOR-STANDALONE - MISCMotor - TP

Thank you once again...

Kind Regards,

Ranjan Poojary