Forum Discussion
Conditonal Column based on a string
- 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.
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.
- dk_dk2 years ago
Super User
And here is how you would need to configure a conditional column in Power Query instead:
Hope this helps.