Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Using Power M to return a value based upon a partial match

I have looked but I don't think this is possible, but hopefully I'm wrong. BTW, I'm making things up here, so ignore any logical issues 🙂

 

 

Ticket IDLong Description
1237Active Directory Failure Node 128
1238NAS Storage Failure
1239Active Directory Truncation Error
1240Memory Failure
1241Add Memory to node 18132

 

The descriptions are generally similar but are verbose. We want to categorize them, right now we are using an if statement where we use Text.Contains for the various categories. If text contains Active Directory we add a new column with Active Director, Memory events, have a value of memory.

 

This "if Text.Contains" statement is difficult to maintain, so I was thinking of having a table with the values and have Power BI deal with it.

 

Search ForReturn
Active DirectoryActive Directory
MemoryMemory
NASStorage
SANStorage

 

I was pretty certain that fuzzy match wasn't the solution, and confirmed it wouldn't work. 

 

I did see the post from https://community.powerbi.com/t5/Desktop/Matching-values-in-one-table-using-wildcards-with-string-values/td-p/362582 where they show how to do it in a DAX formula, but I'm trying for this within Power M.

 

Any thoughts are appreciated. Thank you 

  • Anonymous ,

     

    Try this code for a custom column:

    let _text = [Long Description] in
    Table.SelectRows(Search, each Text.Contains(_text, 
    [Search For]))

     

2 Replies

  • camargos88's avatar
    camargos88
    Community Champion

    Anonymous ,

     

    Try this code for a custom column:

    let _text = [Long Description] in
    Table.SelectRows(Search, each Text.Contains(_text, 
    [Search For]))

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks for this.

    Using the example code it works perfectly fine.