Text.Reverse

Updated on

Text.Reverse is a Power Query M function that reverses the characters in a given text value. The function returns the reversed text value.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

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

Description

The Text.Reverse function takes a text string as an input – this can be any text that you want to reverse. The term “nullable” indicates that this function can also accept a null value as an input. The function returns the reversed string, or in case of a null input, it simply returns null.

Examples

Now, let’s see how the Text.Reverse function behaves when we use it in a practical scenario.

Reversing a String

For instance, consider the string “Power Query”. We want to reverse this, making it “yreuQ rewoP”. So, we would use the Text.Reverse function as follows:

Text.Reverse( "Power Query" ) // Output: yreuQ rewoP
Text.Reverse to reverse a string

This formula instructs Power Query to reverse the sequence of the characters in “Power Query”. The output, as expected, is “yreuQ rewoP”, the reversed string.

Handling Null Values

As the syntax suggests, the function accepts null values to. The term “nullable text” indicates this. When you provide the function with a null value, it returns null.

Text.Reverse( null ) // Output: null
Text.Reverse and null values

In summary, the Text.Reverse function is useful for anyone using the Power Query M language, providing a simple way to reverse text strings.

Learn more about Text.Reverse in the following articles:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/text-reverse

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