Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Replace field value, if condition

Hi,

I have a table in which I want to replace certain field names subject to one condition. I have a table with three fields as below. I want to replace the field value in Identifier with Identifier 2 if the activity is Abnormal or Insufficient. The result table is found below in which I added the changes in bold font. Thank you in advance!

Initial table:

IdentifierActivityIdentifier 2
123Normal321
1234Normal4321
12345Abnormal54321
123456Insufficient654321

Result table:

IdentifierActivityIdentifier 2
123Normal321
1234Normal4321
54321Abnormal54321
654321Insufficient654321
1 Solution

Accepted Solutions
Not applicable
Author

Untested syntax.

LOAD

     if(Activity = 'Abnormal' or Activity = 'Insufficient', [Identifier 2], Identifier) as Identifier,

     ....

FROM.

     ...

View solution in original post

5 Replies
Not applicable
Author

Untested syntax.

LOAD

     if(Activity = 'Abnormal' or Activity = 'Insufficient', [Identifier 2], Identifier) as Identifier,

     ....

FROM.

     ...

manojkulkarni
Partner - Specialist II
Partner - Specialist II

Load

if(Activity='Abnormal' or Activity='Insufficient', Identifier2,Identifier) AS Identifier

Activity,

Identifier2

From Table1..

vardhancse
Specialist III
Specialist III

Yes, for Identifier we can make a condition instead of direct field.

if(Activity='Abnormal' or Activity ='Insufficient', Identifier2,Identifier) as Identifier,

This will check the Activity values if satisfies any one then identify2 value will be place for Identifier, if not Identifier value will be placed

Not applicable
Author

Thanks everyone! Such a simple answer. Cheers!

venkat1
Creator II
Creator II

How to write if want to rename with multiple field values?