Announcements
Product Release Webinar: Qlik Insider airing December 6! REGISTER TODAY!
cancel
Showing results for
Did you mean:
Anonymous
Not applicable

## Search string for certain word (Calculated Dimension)

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

1 Solution

Accepted Solutions
Master III

Hi Stefan

Calculated Dimension

=If(WildMatch(Field1,'*OLD*'),'Old','New')

Regards,

Antonio

5 Replies
Specialist

IF(INDEX(Field1,'OLD')>0,'Old', 'New')

Master II

Hi,

Try like this

,Replace(Dim,'OLD','New') as Cal

;

Dim

shoe_OLD_4512

Shirt45OLD_78942

ShoeNEW_5698

Shoe2OLD_56821

];

Specialist

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.

Master III

Hi Stefan

Calculated Dimension

=If(WildMatch(Field1,'*OLD*'),'Old','New')

Regards,

Antonio

Anonymous
Not applicable
Author

Hi Antonio

That worked! How easy can it be

Thanks to you all for responding to quick

Regards

Stefan

Community Browser