Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Extracting Specific Text from a String Type Column

I have a text string column in my dataset that contains random strings. However, some of the records contain location information within the strings. An example of this is: EU-Romania- Server and the...
  • parry2k's avatar
    parry2k
    6 years ago

    Anonymous I don't why wouldn't post these rules in your original post, how someone will get to know what to do. Read this post to get your answer quickly.

    https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

     

    Anyhow, add new column with following expression.

     

    MyRegion = 
    SWITCH ( TRUE(),
        SEARCH ( "EU", Table[Data], , -1 ) >= 0, "EU",
        SEARCH ( "Name", Table[Data], , -1) = -1 && SEARCH ( "NA", Table[Data], , -1 ) >= 0, "NA",
        SEARCH ( "APAC", Table[Data], , -1 ) >= 0, "APAC",
        ""
    )