SSRS Right Function

The SSRS Right function is a Text function that returns the specified number of Right side characters from the given field. This article explains how to use the Right function to build a string from a few rightmost characters with an example.

The syntax of the SSRS Right function to create a new string containing the specified number of rightmost characters is as shown below.

=Right(Fields!FullName.Value, 7)

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

Source Table

SSRS Right function Example

For this, let me add a new column to the right side of the Name column. Next, right-click the textbox under the Last 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 return the rightmost characters from the name field. The below SSRS Right function returns the last five characters (right-side five) from the Name column and builds a new string.

=Right(Fields!Name.Value, 5)
SSRS Right Function expression to extract right-side characters

Please click the preview tab to see the rightmost five characters from the Name field. For more functions >> Click Here!

SSRS Right Function to extract the last name

Let me use this Right function to extract the LastName from the Name field. To do so, edit the expression and write the one shown below. First, the InStr function finds the index position of the space. Second, the Len function returns the length of the Name fields. Third, subtract the integer return by InStr() from the total length. Next, the SSRS Right function returns the characters from the right side until they reach the empty space.

=Right(Fields!EmpID.Value, Len(Fields!Name.Value) - InStr(Fields!Name.Value, " "))
Expression to get the domain name

Similarly, let me create one more column to the right of the Email column. Next, right-click the textbox under it to write the below expression. Here, the Right function returns the rightmost characters from the Email column up to the @ symbol. Technically, it extracts the domain name from the Email address.

=Right(Fields!Email_Adress.Value, Len(Fields!Email_Adress.Value) - InStr(Fields!Email_Adress.Value, "@"))

Please check the report preview.

SSRS Right Function to extract last name and domain name characters preview