RIGHT Function (DAX)

 

RIGHT returns the last character or characters in a text string, based on the number of characters you specify.

RIGHT(<text>, <num_chars>)  

Parameters

TermDefinition
textThe text string that contains the characters you want to extract, or a reference to a column that contains text.
num_chars(optional) The number of characters you want RIGHT to extract; is omitted, 1. You can also use a reference to a column that contains numbers.

If the column reference does not contain text, it is implicitly cast as text.

A text string containing the specified right-most characters.

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

This DAX function may return different results when used in a model that is deployed and then queried in DirectQuery mode. For more information about semantic differences in DirectQuery mode, see http://go.microsoft.com/fwlink/?LinkId=219171

Description

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

Code

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

Description

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.

Code

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

Text Functions (DAX)
LEFT Function (DAX)
MID Function (DAX)

Community Additions

ADD
Show: