Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello All,
My current data is loaded like this:
User ID | Year | Group |
---|---|---|
A | 2012 | WWW |
B | 2012 | XXX |
C | 2012 | YYY |
D | 2012 | ZZZ |
I have a new table I need to use to replace the Group Ids for a particular set of User IDs.
User ID | Group |
---|---|
B | RRR |
D | RRR |
I tried an if statement along these lines but wasnt sure if I should use some type of =match, replace
Thanks,
EK
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 ....
Maybe this:
if(match("User ID",'B','D'), 'RRR', Group) as Group
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 ....
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