Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Search for a string using a keyword table

Hi,

I have a data table and a keyword table as shown in the picture.

I'd like to use an slicer with the Filter Category (from the Key Table) to get data from the first table. i.e. If a select "Section 10" in the slicer I will get  "10 Section XAW" & "10-sect INI".

Originally I created a new column in the TABLE_DATA with IF and CONTAINSSTRING, but there is a large amount of Key Words that I need to manage.

Key Words Column =
if (CONTAINSSTRING(TABLE_DATA[Description],"10*Sect*"),"Section 10",
if(CONTAINSSTRING(TABLE_DATA[Description],"8*Sect*"), "Section 8", ....

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous 

     

    It depends on what you want, if you need a column, and if you can use Power Query, go to add a column with a custom function to get your keyword column in your table_data; if you need to display the Description in a visual, then use a measure instead, I use the Filters pane to filter this test measure to "is not blank". 

    test = 
    VAR CurKeyword=SELECTEDVALUE(Table_Key[Keywords])
    RETURN
    IF(CONTAINSSTRING(MAX(Table_Data[Description]),CurKeyword),"")

     

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

     

    It depends on what you want, if you need a column, and if you can use Power Query, go to add a column with a custom function to get your keyword column in your table_data; if you need to display the Description in a visual, then use a measure instead, I use the Filters pane to filter this test measure to "is not blank". 

    test = 
    VAR CurKeyword=SELECTEDVALUE(Table_Key[Keywords])
    RETURN
    IF(CONTAINSSTRING(MAX(Table_Data[Description]),CurKeyword),"")

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Sweet!

    It'd be nice to be able to use this Measure as a filter for the whole page, anyway applying the filter manually to each visual is not a big deal for now.