SSRS Replace Function

The SSRS Replace function is a Text function that will replace the part of a string field with the user-given substring and return a string—for instance, changing the word or set of characters in the product description.

The syntax of the SSRS Replace function accepts three arguments, as shown below. The first argument is the actual string column. The second one is either a string or character to replace from the string column, and the third is the substring to replace.

=Replace(Fields!ProductDescription.Value, "bike", "Cycle")

To demonstrate the SSRS Replace function, we use the Employee table below, which has 15 records. The image shows the records in the Table report.

Source Table

SSRS Replace function Example

For this, let me add a new column to the right side of the Occupation column. Next, right-click the textbox under the Replace Name and choose the Expression. To understand the report, I suggest you refer to the articles on charts, tables, grouping, and format tables in SSRS.

Choose the expression option

It opens the following expression window to perform string replacement. The below SSRS Replace function will find the “a” character inside the Occupation column and replace every occurrence of “a” with a “TG” substring.

=Replace(Fields!Occupation.Value, "a", "TG")
SSRS Replace Function expression to replace a string or character

Similarly, let me create one more new column to the right of the Education. Here, we use the complete word(instead a character) as the Replace function arguments, so code below replaces School (if exists) with College.

=Replace(Fields!Education.Value, "School", "College")

Please click the preview tab to see the report. For more functions >> Click Here!

SSRS Replace Function to replace a string or character preview