Forum Discussion
Create new Column based on other column data
- Anonymous6 years ago
Hi rclay78 ,
You may try this calculated column.
New Column = SWITCH ( TRUE (), CONTAINSSTRING ( 'Tickets'[data], "abc" ), "abc", CONTAINSSTRING ( 'Tickets'[data], "efg" ), "efg", CONTAINSSTRING ( 'Tickets'[data], "hjk" ), "hjk", CONTAINSSTRING ( 'Tickets'[data], "awd" ), "awd", CONTAINSSTRING ( 'Tickets'[data], "dbb" ), "dbb" )Reference: SWITCH function
CONTAINSSTRING function
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You can use a nested if then else to get your result in a custom column in the query editor
= if Text.Contains([Data], "abc") then "abc" else if Text.Contains([Data], "efg") then "efg" else ...
There are more sophisticated ways to do it but that should get you started.
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat
I already have my table established. I am wanting to create a new column in DAX
- mahoneypat6 years agoMicrosoft Employee
Ok. You can do the same nested IF approach in DAX
NewColumn = IF(SEARCH("abc", Table[TextColumn]),,0)>0, "abc", IF("efg", ...
If this works for you, please mark it as the solution. Kudos are appreciated too. Please let me know if not.
Regards,
Pat