OpenBI Docs Buy

Replacer.ReplaceText

Replaces every occurrence of a piece of text inside a text: the replacer for parts of values.

Group: Splitters, combiners, replacers and comparers. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Replacer.ReplaceText(text as nullable text, old as text, new as text) as nullable text
ParameterTypeDescription
textnullable textThe text to change; null gives null.
oldtextThe text to look for, matched with its capitals.
newtextWhat to put in its place.

Returns

nullable text. The text with every occurrence replaced.

Remarks

Examples

Inside the cells of a column

let
    Shops = #table({"Shop"}, {{"Oslo City"}, {"Bergen City"}})
in
    Table.ReplaceValue(Shops, "City", "Centre", Replacer.ReplaceText, {"Shop"})
Shop
Oslo Centre
Bergen Centre

Every occurrence

Replacer.ReplaceText("Sales Sales", "Sales", "Revenue")
"Revenue Revenue"

Replacer.ReplaceValue, Table.ReplaceValue, List.ReplaceValue, Text.Replace.

Last updated · OpenBI Studio 0.3.79