Downloads
Power Query MTextIntermediate

Text.Reverse

Returns the characters of a text value in reverse order.

Syntax
Text.Reverse(text as nullable text) as nullable text

Returns: The reversed text, or null when the input is null.

What it does

Text.Reverse flips the characters of a value. On its own it is rarely needed in a finance report, but it is a short way to find the last occurrence of something in a string, or to read a code from the right. It is the M equivalent of the reversal trick people use in spreadsheets.

Syntax and arguments

Example

A data team wants the file extension of a bank file name without knowing how long the base name is. Reversing the name makes the extension the first part.

let
    FileName = "stmt_2026_09.csv",
    Reversed = Text.Reverse(FileName),
    ExtReversed = Text.BeforeDelimiter(Reversed, "."),
    Extension = Text.Reverse(ExtReversed)
in
    Extension

Reversed is "vsc.90_6202_tmts". The text before the first dot in that reversed value is "vsc", and reversing it again gives "csv". The result is "csv".

Example: a second, different use

Check a check digit by reversing an account number and testing each digit from the right.

Things to watch

In business terms

Reversal is rarely the right tool in a finance report. It is useful for odd cases such as reading a suffix from a long code, or for check digit logic in a bank or tax number.

Related functions

All Power Query M functions · View as Markdown · M basics