I have the following column:
I would like to do the following replacements within Medium field: cpc --> PPC
none --> Direct
organic --> SEO
email --> Campaign
what function would be the best to use and how would the script look like?
Try like this
Whether use if condition
Mapping load * inline[
And then use ApplyMap, both helps
How would it look like with more than 2 if conditions?
ApplyMap is the better option.
i agree applymap looks nicer
but there you go
if (Medium='cpc', 'PPC', if (Medium='none', 'Direct', If (Medium='organice', 'SEO', if (Medium ='email', 'Campaign', null())))) as new_field;
If the Replacement texts are less then you can go with this option also
Pick(Match(Medium,'cpc','none', 'organice','email'),'PPC','Direct','SEO','Campaign') AS NewField
MAPPING LOAD * INLINE [
MAP Medium UISNG MeduimMap;
Retrieving data ...