Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I want to create a calculated dimension which searches in a string for a certain word, and then if the string contains that word, is should be named something
Example
Dimension name : Field1
Field 1 contains below data strings
- shoe_OLD_4512
- Shirt45OLD_78942
- ShoeNEW_5698
- Shoe2OLD_56821
......
I want a calculated dimension that searches every string for the word Old, if the string contains the word OLD, then its should be named Old, otherwise New.
However, I can only seem to find a answer which searches the strings based on a locked position of the word your a searching for. Meaning that the word OLD should be in the same place every time for the calculated dimension to be working.
Is there a way to achieve it?
Any helped is very much appreciated.
Best
Stefan
Hi Stefan
Calculated Dimension
=If(WildMatch(Field1,'*OLD*'),'Old','New')
Regards,
Antonio
How about using INDEX?
IF(INDEX(Field1,'OLD')>0,'Old', 'New')
Hi,
Try like this
load *
,Replace(Dim,'OLD','New') as Cal
;
LOAD * INLINE [
Dim
shoe_OLD_4512
Shirt45OLD_78942
ShoeNEW_5698
Shoe2OLD_56821
];
Hello, Stefan!
You can use more intuitive expression: if(Filed1 like *old*,'OLD','NEW').
The one of advantages is it's not a case sensitive. So it's equaly will search for "OLD", "Old", "old" etc.
Hi Stefan
Calculated Dimension
=If(WildMatch(Field1,'*OLD*'),'Old','New')
Regards,
Antonio
Hi Antonio
That worked! How easy can it be
Thanks to you all for responding to quick
Regards
Stefan