REPLACE Function (DAX)
REPLACE replaces part of a text string, based on the number of characters you specify, with a different text string.
The string of text that contains the characters you want to replace, or a reference to a column that contains text.
The position of the character in old_text that you want to replace with new_text.
The number of characters that you want to replace.
The replacement text for the specified characters in old_text.
A text string.
Whereas Microsoft Excel has different functions for use with single-byte and double-byte character languages, DAX uses Unicode and therefore stores all characters as the same length.
This DAX function may return different results when used in a model that is deployed and then queried in DirectQuery mode. For more information about semantic differences in DirectQuery mode, see http://go.microsoft.com/fwlink/?LinkId=219171.
The following formula creates a new calculated column that replaces the first two characters of the product code in column, [ProductCode], with a new two-letter code, OB.
=REPLACE('New Products'[Product Code],1,2,"OB")