Downloads
DAXTextBeginner

RIGHT

Returns the last characters of a text value.

Syntax
RIGHT(<text>, <num_chars>)

Returns: Text (a scalar).

What it does

RIGHT returns the number of characters you ask for, counting from the end of the text. It is the way to read a suffix, such as the last four digits of a bank account, a check digit at the end of a code or the final part of a reference. The result is text.

Syntax and arguments

Example

The AP team shows the last four digits of a vendor's bank account on the payment review screen, so the approver can confirm it without seeing the full number.

Account Ending = "ending " & RIGHT(Vendors[BankAccount], 4)

A bank account of 1234567890 displays as "ending 7890". Show only the masked form on screens that many people can see, and keep the full number in a restricted table.

Example: a second, different use

Pick the file type from a document name, such as "invoice-0142.pdf", by reading the last three characters:

File Type = RIGHT(Documents[FileName], 3)

The result is "pdf". A filter on this column then separates PDFs from spreadsheets in a document inventory.

Things to watch

In business terms

RIGHT is used to show partial account numbers for review, to read file extensions and to split a reference that carries a suffix such as a version number or a check digit. In controls work it supports the rule that sensitive data is displayed only in masked form.

Related functions

All DAX functions · View as Markdown · DAX fundamentals