SUBSTITUTE DAX Function (Text)

Replaces existing text with new text in a text string.

Syntax

SUBSTITUTE ( <Text>, <OldText>, <NewText> [, <InstanceNumber>] )
Parameter Attributes Description
Text

A string of text, or a reference to a cell containing text, in which you want to substitute characters.

OldText

The existing text you want to replace. If the case of old_text does not match the case in the existing text, SUBSTITUTE will not replace the text.

NewText

The text you want to replace old_text with.

InstanceNumber Optional

The occurrence of old_text you want to replace. If omitted, every instance of old_text is replaced.

Return values

Scalar A single string value.

The modified string.

Remarks

Use the SUBSTITUTE function to replace specific text in a text string; use the REPLACE function to replace any text of variable length that occurs in a specific location in a text string.

The SUBSTITUTE function is case-sensitive. If case does not match between Text and Oldtext, SUBSTITUTE will not replace the text.

Related functions

Other related functions are:

Last update: Dec 13, 2018   » Contribute   » Show contributors

Contributors: Alberto Ferrari, Marco Russo

MSDN documentation: https://msdn.microsoft.com/en-us/query-bi/dax/substitute-function-dax

DAX Conventions
Context Transition

This function performs a Context Transition if called in a Row Context. Click to read more.

Row Context

This expression is executed in a Row Context. Click to read more.

Iterator

Not recommended

The use of this function is not recommended. See Remarks and Related functions for alternatives.

Not recommended

The use of this parameter is not recommended.

Deprecated

This function is deprecated. Jump to the Alternatives section to see the function to use.

Deprecated

This parameter is deprecated and its use is not recommended.

Contribute

Want to improve the content of SUBSTITUTE? Did you find any issue? Please, report it us!
All submissions will be evaluated for possible updates of the content.