Forum Discussion

enzos's avatar
enzos
Frequent Visitor
5 years ago

Search for specific text values from a dictionary column

Hi, I'm trying to recreate an excel report to PBI. What i am having troubles recreating is the dictionary table which allows us to search for an specific keyphrase in Table A and categorize them into groups.

 

Example:

 

Table A

 

Incident NumberSubmit DateDescription
Incident0014/1/2020Ice cream machine broken again
Incident0024/2/2020Candy Machine is low on chocolate bars
Incident0034/3/2020Washing machine on Floor b not working
Incident0044/4/2020Low on paper floor 1

 

Dictionary Table

 

KeyPhrase 1KeyPhrase 2Display as Category
Ice creamMachineRepairs - Maintanence
CandyMachineRepairs - Maintanence
WashingMachineRepairs - Maintanence
Paper Restock

 

Then we run some macros that would search the description column in Table A to find any matches in the dictionary table from KeyPhrase1 and KeyPhrase2, if there is a match then the category would be added as an extra column.

 

Table A

 

Incident NumberSubmit DateDescriptionCategory
Incident0014/1/2020Ice cream machine broken againRepairs - Maintanence
Incident0024/2/2020Candy Machine is low on chocolate barsRepairs - Maintanence
Incident0034/3/2020Washing machine on Floor b not workingRepairs - Maintanence
Incident0044/4/2020Low on paper floor 1Restock

 

I was able to find a similar problem here but the user wanted the fix to be done in M, however i want it to be done using DAX if possible as we would be manually adding more information to the dictionary table.

 

Thank you in advance ! 🙂 

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Do you have a finite number of key words to look for?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Anyway, where I'm going with that is, if you have a limited number of search words, you can add a column to your table for each search word like this:

     

    SearchField1 = SEARCH("<keyword to search for>",'<your table>'[<column to search>],1,0)

     

    Then you will either have a 0 in the column if the keyword isn't in the field being searched or a non-0 if it is. 

    • enzos's avatar
      enzos
      Frequent Visitor

      Hi,

       

      I read through the article but sadly i coudlnt find something that could help, what im looking for is a way to search a column against another column, and if it finds a match to then give me the corresponding category.

       

      I am looking for a way to find a keyphrase from table dictionary in column description from Table A, and if there is a match with one of the keyphrases to match it and pull the corresponding category.

       

      I could create multiple columns that each search for a keyphrase but as we add more and more keyphrases that would be inefficient.

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        HI enzos,

        According to your description, I think you may need 'machine learning' or AI insight to recognize and analyze your table records instead of manually checking and replace text with DAX formula. You can take a look at the following document to know more about these:

        Use AI Insights in Power BI Desktop 

        Regards,

        Xiaoxin Sheng