DAX Function Guide

SUBSTITUTE
Empty image or helper icon

Sam McKay

CEO & Founder

How does the SUBSTITUTE work?
The SUBSTITUTE function (DAX) replaces existing text with new text in a text string.
SUBSTITUTE Formula Syntax

SUBSTITUTE (
     <text>, <old_text>, <new_text>, <instance_num>
)

How do you use the SUBSTITUTE?

The SUBSTITUTE function can replace text by matching. Use the SUBSTITUTE function when you want to replace text based on its content, not position. Optionally, you can specify the instance of found text to replace (i.e. first instance, second instance, etc.).

Related Blog Posts

Loading

Considerations when using the SUBSTITUTE?
  • SUBSTITUTE finds and replaces old_text with new_text in a text string.
  • Instance limits SUBSTITUTE replacement to one particular instance of old_text. if not supplied, all instances of old_text are replaced with new_text.
  • Use SUBSTITUTE to replace text based on content. Use the REPLACE function to replace text based on its location.
  • SUBSTITUTE is case-sensitive and does not support wildcards.
Related Video Tutorials

Loading

Formula examples using the SUBSTITUTE

=SUBSTITUTE([Product Code], “NW”, “PA”)

=SUBSTITUTE(B6,”t”,”b”)

=SUBSTITUTE(B8,”cat”,”dog”)

Related Courses

Loading