RIGHT

Updated on

RIGHT is a DAX function that returns a specified number of characters from the end of a text string.

Syntax

RIGHT(
   Text,
   NumberOfCharacters
)
Argument Properties Description
Text The text string that contains the characters you want to extract.
NumberOfCharacters Optional The number of characters you want to extract; if omitted, 1.

Return Values

A text string containing the specified right-most characters.

Remarks

  • RIGHT always counts each character, whether single-byte or double-byte, as 1, no matter what the default language setting is.

  • This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.

Example: Returning a Fixed Number of Characters

The following formula returns the last two digits of the product code in the New Products table.

= RIGHT('New Products'[ProductCode],2)

Example: Using a Column Reference to Specify Character Count

The following formula returns a variable number of digits from the product code in the New Products table, depending on the number in the column, MyCount. If there is no value in the column, MyCount, or the value is a blank, RIGHT also returns a blank.

= RIGHT('New Products'[ProductCode],[MyCount])

Other functions related to RIGHT are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/dax/right-function-dax

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy