Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Conditonal Column based on a string

Morning All   Im sure there is an easy way to do this.   Maybe using a switch function as that can cater for blanks?   I have a table that will have data like that in Table 1 Column 1   I wan...
  • dk_dk's avatar
    2 years ago

    Hi Anonymous ,

    You can do this in Power Query as well with a conditional column, but if you want to add a DAX calculated column you can try this:

     

    Conditional Column = 
    
    SWITCH(TRUE(),
    CONTAINSSTRING(Source[Data Source],"APP"), "IT Application",
    CONTAINSSTRING(Source[Data Source],"ITC"), "IT Component",
    "Other")


    You can replace "Other" with just "" if you want to show blanks on no match, and you can also expand the switch statement to search for additional strings and display a different result.