Forum Discussion
vat2do
Helper III
4 years agoHow to create new column using existing columns with a condition
Hope you have a good day, I need to create a new column based on existing column but to combine some cell values with text datatype into a different text value. fo example, i have a column nam...
- 4 years ago
Hi,
I tried to create a sample pbix file like below, and please check whether it suits your dataset.
I hope the below can provide some ideas on how to create a solution for your dataset.
Please check the below picture and the attached pbix file.
New column CC = SWITCH ( TRUE (), CONTAINSSTRING ( Data[Category], "ABC" ), SUBSTITUTE ( Data[Category], "ABC", "XYZ" ), CONTAINSSTRING ( Data[Category], "DEF" ), SUBSTITUTE ( Data[Category], "DEF", "XYZ" ), Data[Category] )
Jihwan_Kim
Super User
4 years agoHi,
I tried to create a sample pbix file like below, and please check whether it suits your dataset.
I hope the below can provide some ideas on how to create a solution for your dataset.
Please check the below picture and the attached pbix file.
New column CC =
SWITCH (
TRUE (),
CONTAINSSTRING ( Data[Category], "ABC" ), SUBSTITUTE ( Data[Category], "ABC", "XYZ" ),
CONTAINSSTRING ( Data[Category], "DEF" ), SUBSTITUTE ( Data[Category], "DEF", "XYZ" ),
Data[Category]
)