Forum Discussion
foyadeyi
5 years agoFrequent Visitor
Conditions containing multiple strings in a column
I am trying to make conditions that contain certain strings and all the solutions I found online didnt work or tedious. I have a column that contains over 400 cities and I am trying to group them int...
- 5 years ago
Okay foyadeyi in that case we have to create a custom column through "Edit Query" with below code:-
if List.AnyTrue(List.Transform({"Berlin","Bremen","Hamburg"},(substring ) => Text.Contains([city],substring))) then "North" else if List.AnyTrue(List.Transform({ "Munich", "Ausgburg", "Wurzburg"},(substring ) => Text.Contains([city],substring))) then "South" else if List.AnyTrue(List.Transform({ "Luverkusen", "Bielefeld", "Trier" },(substring ) => Text.Contains([city],substring))) then "West" else [city]
foyadeyi
5 years agoFrequent Visitor
Samarth_18 Thanks a lot. It worked!