Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

if-replace

Hello All,

My current data is loaded like this:

User IDYearGroup
A2012WWW
B2012XXX
C2012YYY
D2012ZZZ

I have a new table I need to use to replace the Group Ids for a particular set of User IDs.

User IDGroup
BRRR
DRRR

I tried an if statement along these lines but wasnt sure if I should use some type of =match, replace

Thanks,

EK

1 Solution

Accepted Solutions
Not applicable
Author

Hi EK, you can use IF and MATCH function to achieve above:

LOAD [User ID],

          Year,

          IF(match([User ID],'B','D'),'RRR',Group) AS Group

From SourceTable;

In this case you have B, D only/ If you have more User ID's with different values , you use Applymap.

MAP_GROUP:

MAPPING

LOAD [User ID], Group

From NewSourceTable;

LOAD [User ID], Year, ApplyMap('MAP_GROUP',[User ID], Group) AS Group FROM SourceTable;


Hope this help you ....

View solution in original post

3 Replies
Anonymous
Not applicable
Author

Maybe this:

if(match("User ID",'B','D'), 'RRR', Group) as Group

Not applicable
Author

Hi EK, you can use IF and MATCH function to achieve above:

LOAD [User ID],

          Year,

          IF(match([User ID],'B','D'),'RRR',Group) AS Group

From SourceTable;

In this case you have B, D only/ If you have more User ID's with different values , you use Applymap.

MAP_GROUP:

MAPPING

LOAD [User ID], Group

From NewSourceTable;

LOAD [User ID], Year, ApplyMap('MAP_GROUP',[User ID], Group) AS Group FROM SourceTable;


Hope this help you ....

Not applicable
Author

Ah of course! Usually use mapping for adding fields but of course it could do the trick for replacing existing field values too. thanks!

EK