Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following column:
Medium:
cpc
cpc
none
none
none
organic
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?
Thanks,
Hi
Try like this
Whether use if condition
or
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;
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;
MediumMap:
MAPPING LOAD * INLINE [
cpc, PPC
none, Direct
organic, SEO
email, Campaign
]
;
MAP Medium UISNG MeduimMap;
-Rob
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