Clean and split text
Normalize labels, not identities
Text cleanup is a policy, not a universal correction. Trim removes boundary characters; Clean removes nonprintable characters. Neither automatically standardizes spelling, internal spacing, case or business identity. IDs may contain meaningful spaces or zeros: preserve raw keys unless a documented normalization and collision check justify changes. All examples are standalone blank-query expressions for Power Query M in a disposable Power BI Desktop file. No external source or account is needed. Results are predicted, not native execution evidence; exact Desktop build NOT RUN.
Clean, replace and split a controlled label
let Raw = #table(type table [ID = text, Route = text], {{"001", " North|Retail "}, {"002", "South|Web#(tab)"}}), Clean = Table.TransformColumns(Raw, {{"Route", each Text.Trim(Text.Clean(_)), type text}}), Split = Table.SplitColumn(Clean, "Route", Splitter.SplitTextByDelimiter("|", QuoteStyle.None), {"Region", "Channel"}, null, ExtraValues.Error), Standard = Table.ReplaceValue(Split, "Web", "Online", Replacer.ReplaceValue, {"Channel"})in StandardExpected: 001 | North | Retail and 002 | South | Online. The source grammar requires exactly two nonempty tokens separated by one pipe. ExtraValues.Error guards extra tokens, but missing tokens default to null here; validate token counts and empty tokens separately before loading. Replacer.ReplaceValue matches the whole cell; Replacer.ReplaceText performs substring replacement and may alter unintended labels. For example, replacing Web as a substring could also change WebStore.
Fill a deliberate continuation and combine display fields
let Raw = #table(type table [Region = nullable text, Channel = text, Amount = number], {{"North", "Retail", 20}, {null, "Online", 10}, {"South", "Retail", 15}}), Filled = Table.FillDown(Raw, {"Region"}), Label = Table.AddColumn(Filled, "Display", each Text.Combine({[Region], [Channel]}, " / "), type text), Merged = Table.CombineColumns(Label, {"Region", "Channel"}, Combiner.CombineTextByDelimiter(" / ", QuoteStyle.None), "MergedLabel")in MergedExpected Display and MergedLabel are both North / Retail, North / Online, South / Retail, with amounts 20, 10, 15. The source format explicitly uses a blank region to continue the previous region. FillDown propagates into null cells, not arbitrary empty strings, and depends on row order; do not fill across independent sections or unknown business values. CombineColumns replaces its source columns; AddColumn retains them. In production prefer the retained fields for filtering and use the merged label for display only. A joined display label is not automatically a unique key.
Guard against collisions and malformed text
If raw keys A and A become the same after trimming, inspect whether they represent one entity before deduplicating. Do not remove meaningful punctuation or change all identifiers to uppercase blindly. A token count of two still permits empty tokens: reject North| under the two-nonempty-parts policy. Keep null as unknown unless the source contract says it is a continuation. If needed, convert blank text to null explicitly before filling and record the decision.
Practice: add malformed routes
Evaluate East|Web, East|Web|Retail, and East| under the stated grammar. Predict the accepted standardized fields and explain which two records must be rejected and why. Preserve each raw record and ID in the reject table.