Name split in PQ

Hi @ammu,

The current POTW is relevant to your question, you can find all about that here.

.
Wow amazing to see so many responses already to this question.
Here’s my attempt - just paste this M script into a new blank query.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("xVjbcuJIEv2VjH7aiRj1SOKqfitEGYSFpJEEXkdvPxRQxooWEquLPd6v3yxdjAAB7p7eWD84oOpkVuXtZBZfv34ayP3OH7Ki9BR50JNGC8syrIkHD8SlU3vh0U+/f2pZ/Pb710+GtZSVgSrdw79yWVb74INuUiKg4FF3aejUQ+mr2wc93b+tR9HknjRx6QSmi8m0kGl+KyGa1pXVoUTWiWRYhm8QE6aPE4NawtDTlWMRyaWWb98bJtQ4x38E0x+j5MUtoUKTB0O8GLnzbQu8KaX+nPrELO53tlh4ZPkliF4kWVZki9yPFobpN846WxIiug7g8T2osjSZ0ZG9MH3JC7ZRCk9xAmy3ykMWrbk4s9o+FUMDRoYlzVkQZTwSYAgyvisVvARhyMTZBehU1JtjhkhjtuZvAsghC3YrnhSSSbzi8IyiBejCoSYdgxlsnzPYhohPL540mxu+a2PMp5LFX+E7fxPYw2rtPmMpl3+qqsgPxNenju02nXi+Vp9kr7ODTTpLgmi7Ys+w4tH6GVLOssq69MymSrKyyeVPebQpfHDJqErgPWAO3/A0SwIWgYhdW7BORbw955sCnX4E7udJwnbiH3jsiWdvMA+SJE7aZK345Uh2lLD1d56VCXHj3FPZEp6+J+T7PX5MGFblHa5IzafEsKgnjflzvgs2wdMbF4dUyzfRwRkas6mrDu8My6ITYhUcNPAAv1MQZThGHkKJ6/uVHllT5J466EzJhLj+Y43V7bljUp+Ca9t3gtb+YXkPv4GDaj+KrM0a8/Wx68ogH5jA/uttyzG92jxYCZeZ74T5NoU5S+IcnQ4u0c/y/Qj/IGLERMKLD9mzSKs8vCTzfsH6Pi3pjg4jvb42oGRiUhjTJTVtZ45ECxPXXgjvXNqppfuKqvyctLjqDMtQVST9kbhjkz5Kep5kSI7IaKWhLMvY+nnHxcVr0EXhB5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JVWDvyT4W1dKymaf1f7Nj6WsOfzLbODY+XoNspqWhd5XbsKhqsYuLt4u9iLmIJZxDs9kn8UhB1SzCrJlIJzoN0LWgz4nGOLSiJd1BPcBdF77HAHywTicARv7GIn7TqlctQnTjISi69W7ijaxI1TfyZY2/DF18jK5vsQBwwopcvgM7qwnVvNaD9j0OHH4Bayy9Q/DSj9jUgpgl3RDdM4yjH/jALRr6016Jq8DdVlQb05A/aWj5x1B5+uBM/+tFDpcyRm32KTxC9/FHx2n6Lyv4vVIkGqR8N3lAGauhTG4dwR6gTT6dqghxT3XaJX/7U8QFQU29n0Jcse6nK4PnUmVILRgtvii1WdOqTlaZcxSv9Dvw4sTSHOA9veydGDTGJ4VtVTHEs2QHOb8XD9QA4dsdA+5+4A81SVVlV4CPzx/tl+pqiDmH2mX7WPxPDxZHeGhvC9Mb7VjxZrwO+ffsv", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Start = _t, #"Expected Decription" = _t]),
    GetName = Table.AddColumn(Source, "Custom", each 
        let
            fxSplit = Splitter.SplitTextByAnyDelimiter({"0".."9"}&{"/","-"}, QuoteStyle.Csv),
            InvokeSplit = fxSplit([Start]),
            RemoveBlanks = List.RemoveItems( List.RemoveFirstN( InvokeSplit, 1), {"", null, "A", "NOV", "CAPEX REFURB", "REPLACEMENT CURTAIN HOOKS", "TEST AND TAG UNIT"}),
            KeepStrings = Text.Replace( Text.Trim( Text.Combine( List.Select( RemoveBlanks, each Text.Upper(_) = _ ), " " )), "P L", "P/L")
        in
            KeepStrings, type text)
in
    GetName

I hope this is helpful.

3 Likes