Forum Discussion

JeroniJamboni's avatar
JeroniJamboni
Advocate I
8 years ago
Solved

Search for exact value from table

Hi guys,

 

I am working on a way to add a label to a big list of keywords. In this case i want to extract all keywords that contain a brandname.

I've got a big list of keywords and a table with keywords.

 

I found part of the solution

VAR searchbrand =
FIRSTNONBLANK (
FILTER (
VALUES ( DimBrand[name] );
SEARCH ( DimBrand[name] ; FactKeywords[Keyword]; 1; 0 )
);
1)

RETURN
IF ( NOT ( ISBLANK ( searchbrand ) ); searchbrand; "NOT BRANDED" )

 

However... (example) i got a brandname "ACTI", which is linked to all keywords with "active, action or activate". I can't figger out how to improve this. A brandname is a word on it's own followed and/or preceded by whitespace. Or.... the keyword is equal to the brandname.

How would you guys solve this?

Kind regards,

 

Jeroni Jamboni

3 Replies

  • v-chuncz-msft's avatar
    v-chuncz-msft
    Community Support

    JeroniJamboni,

     

    You may try the following expression.

    SEARCH ( " " & DimBrand[name] & " ", " " & FactKeywords[Keyword] & " ", 1, 0 )
  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Perhaps try FIND instead of SEARCH. FIND is case-sensitive whereas SEARCH is not.

    • JeroniJamboni's avatar
      JeroniJamboni
      Advocate I

      This could be part of the solution. I've capatalized each word in the keywords. With the Find function it helps for most part. But I want to know if there a better solution? Is still end up with too many wrong results.