- DAX Functions Tutorial
- DAX Functions - Home
- DAX Functions - Introduction
- DAX Parameter Naming Conventions
- Description Structure
- DAX Functions - Aggregation
- DAX Functions - Filter
- DAX Functions - Time Intelligence
- DAX Functions - Date and Time
- DAX Functions - Information
- DAX Functions - Logical
- Math & Trigonometric Functions
- DAX Functions - Parent & Child
- DAX Functions - Statistical
- DAX Functions - Text
- DAX Functions - Other
- DAX Functions Useful Resources
- DAX Functions - Quick Guide
- DAX Functions - Useful Resources
- DAX Functions - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
DAX Text - REPLACE function
Replaces part of a text string, based on the number of characters you specify, with a different text string.
REPLACE (<old_text>, <start_num>, <num_chars>, <new_text>)
|Sr.No.||Parameter & Description|
The string of text that contains the characters you want to replace, or a reference to a column that contains text.
The starting position in the 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.
DAX uses Unicode and therefore stores all characters as the same length.
Note − 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.
= REPLACE([Product],1,2, [No. of Units])
This returns a calculated column with the first two characters of the Product in a row replaced with the value No. of Units in the same row.