Replacer.ReplaceText
ReplacerA replacer function that performs substring replacement within text values.
Syntax
Replacer.ReplaceText as functionReturn Value
function — A replacer function that finds and replaces a substring within text cell values.
Remarks
Replacer.ReplaceText is a built-in replacer function used as an argument to Table.ReplaceValue. It performs substring replacement — it finds occurrences of oldValue within the text of each cell and replaces them with newValue, even if the cell contains additional text.
Use Replacer.ReplaceText for partial text replacements (e.g., replacing "Widget" with "Component" inside product names). For replacing entire cell values, use Replacer.ReplaceValue instead.
Examples
Example 1: Substring replacement in product names
Table.SelectColumns(
Table.ReplaceValue(
Table.FirstN(Sales, 4),
"Widget", "Component",
Replacer.ReplaceText, {"Product"}
),
{"CustomerName", "Product", "Category"}
)Result
CustomerName | Product | Category | |
|---|---|---|---|
| 1 | Alice | Component A | Widgets |
| 2 | Bob | Gadget B | Gadgets |
| 3 | Charlie | Component C | Widgets |
| 4 | Alice | Gadget D | Gadgets |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks