Forum Discussion
Creating a Custom column based on Value from one column
- 1 year ago
Hello,
By creating a custom column in powerBI and pasting the following dax query, you will return what you are looking for. (Note that you will need to add more rows for each of your conditions.
NewColumn = SWITCH( TRUE(), SEARCH("ABC", [OriginalColumn], 1, 0) > 0, "ABC", SEARCH("EST", [OriginalColumn], 1, 0) > 0, "EST", BLANK() -- Or you can add another condition here if needed by simply repeating the above lines )Please mark my answer as the solution if this works for you, feel free to respond if you need more clarification!
Have a great day
Hi Anonymous
I think for first two rows, it's not possible in Power BI. If we exclude first two rows, then we can do it by using Power Query Editor.
There is option called Column from examples. If you use that, you'll get the expected out put.
Step-1
Select the Original Column->Addcolumn in top ribbon bar->Click on column from examples(highlighted in yellow)
Step-2
After clicking on column from examples you able to see below picture
If you type first 3 letter, then hit enter button, you'll get automaticall all values as expected. Then click ok on above the first characters column.
Step-3
The just you'll rename the first characters column as Custom Group.
Thanks!