Forum Discussion

cj_sh's avatar
cj_sh
Regular Visitor
6 years ago
Solved

Finding fix text in the string

I am fetching data from SharePoint list.

 

Requirement:

there is a string, from which I need to find two fix words (AD and PC), and send the finding into a new column.

 

 

  • Hi cj_sh ,

     

    You could add if() function to return the results you want.

    if
    Text.Contains([Column1],"PC")=true
    then
    [Column1]
    else
    "Your other result"

     

7 Replies

  • mussaenda's avatar
    mussaenda
    Community Champion

    you can do it on power query or dax

     

    in power query, you can create a conditional column and put your condition there.

    in dax, you can use containsstring function to find your desired words and use if statement

    • cj_sh's avatar
      cj_sh
      Regular Visitor

      mussaenda  Thanks, I don't know why my query editor is not showing ContainsString function among the choices.

       

      but I am trying Text.Contains([ColumnName],"AD"),  and it is giving me True/False  whereever AD in the string. 

      Now I am getting challenge in value AD in the column instead of True.

       

      Can you help me in that.. 

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

        Hi cj_sh ,

         

        You could add if() function to return the results you want.

        if
        Text.Contains([Column1],"PC")=true
        then
        [Column1]
        else
        "Your other result"

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi cj_sh ,

     

    The easiest way to achieve this is Conditional Columns in Power Query. 

    Please Use Operator as contains or Equal according to your other options.

    Please use the attached picture as reference.

     

    Best Regards,

    Gaurav Raj Singh