Forum Discussion

tracyhopaulson's avatar
tracyhopaulson
Resolver I
6 years ago
Solved

if statement custom column

I have a column "Item" that I would like to find all values start with "SK" or "78", then insert a text "Do Not Use" to the custom column, otherwise, carry the values from column Item over as is.  Can someone help with this please?

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi tracyhopaulson 

     

    I would create  a column

    _new_column = IF(LEFT([column],2) IN {"SK","78"}, "Do Not Use",[column])

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi tracyhopaulson 

     

    I would create  a column

    _new_column = IF(LEFT([column],2) IN {"SK","78"}, "Do Not Use",[column])

  • PaulDBrown's avatar
    PaulDBrown
    Community Champion

    tracyhopaulson 

    You can create a custom column in Power Query to meet the output. The interface will allow you to choose between "contains" (to specify the string values) and the output can be custom or a column value

    As an alternative, you can create a custom column using DAX in your table using the function CONTAINSTRING as the variable