DAX Function Guide
REPLACE
Sam McKay
CEO & Founder
How does the REPLACE work?
REPLACE Formula Syntax
REPLACE (
<old_text>, <start_num>, <num_chars>, <new_text>
)
How do you use the REPLACE?
Whereas Microsoft Excel has different functions for use with single-byte and double-byte character languages, DAX uses Unicode and therefore stores all characters at the same length.
This DAX function may return different results when used in a model that is deployed and then queried in DirectQuery mode.
Related Blog Posts
Loading
Considerations when using the REPLACE?
If the argument, num_chars, is a blank or is a reference to a column that evaluates to a blank, then new_text is inserted at the position start_num, without replacing any characters. This is the same behavior as in Excel.
DAX REPLACE function is similar to DAX SUBSTITUTE function.
- You can use REPLACE function, if you want to replace any text of variable length that occurs at a specific position in a text string.
- You can use SUBSTITUTE function, if you want to replace specific text in a text string.
Related Video Tutorials
Loading
Formula examples using the REPLACE
= REPLACE(‘New Products'[Product Code],1,2,”OB”)
Related Courses
Loading