I have a column lets say “Column A” that includes string in mixed cases and special characters etc.
I want to create a new column “Column B” that basically copies all the String / text from Column A only if the string contains word “Level”, and L can be in any case.
Is there a way to do this with M code, in Power Query ?
I guess I am looking at something similar to SQL Like % text% type of query
.
Here’s the full solution, just paste this into a new blank query.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Vc6xDsMgDATQX0HMnfILWbt1RAg5yG1pILbApOHvazXq0BtPT6dzzr4AmKq54o45hGMyT8jpDoeZ5xAiD6MpWGVNe2khJEVUrL8423ruvJlbZx2Q00sdmJWUylSYBoCWJ+cF8j+OeQjKWzXFBII6H+lr11S2h2mMFarQ79wyWe8/", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t]),
AddCustom =
Table.AddColumn( Source, "Column2", each
if List.AnyTrue(
List.Transform(
let mySplit = Splitter.SplitTextByAnyDelimiter( {" ", "__"} ) in mySplit( [Column1] ), each
Text.Contains( _ & " ", "level ", Comparer.OrdinalIgnoreCase)
)
)
then "Escalation"
else null
, type text )
in
AddCustom
Hi @jps, good to see that you are having progress with your inquiry.
Did the response provided by @Melissa help you solve your query? If not, how far did you get and what kind of help you need further? If yes, kindly mark as solution the answer that solved your query.
I am sure there is something I am not doing correct. as I am little unfamiliar with M code. Not sure where to make changes to match the dataset in my Power BI.
So the source Table is named AG,
The Column1 is named Engineers,
Now I am looking to add a column in this table, it already has 10 columns … Should I just be pasting the above code in a new query ? I guess ill need to replace some column name or table names in above code. not sure where exactly.