OpenBI Docs Buy

Text.Replace

A text with every occurrence of one piece of text replaced by another.

Group: Text and characters. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Text.Replace(text as nullable text, old as text, new as text) as nullable text
ParameterTypeDescription
textnullable textThe text to work on; null gives null.
oldtextThe text to find; case counts.
newtextWhat to put in its place.

Returns

nullable text. The text with every occurrence replaced.

Examples

A city renamed

Text.Replace("Oslo, Oslo S", "Oslo", "Bergen")
"Bergen, Bergen S"

Case counts

Text.Replace("Oslo", "oslo", "Bergen")
"Oslo"

Nothing is replaced.

Text.ReplaceRange, Text.Remove, Replacer.ReplaceText, Table.ReplaceValue.

Last updated · OpenBI Studio 0.3.79