Text.End is a Power Query M function that extracts the last specified number of characters from a text value. The function returns a text value containing the last count characters of the input text.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Text.End( text as nullable text, count as number, ) as nullable text
text value that is the last
count characters of the
text. It enables you to specify the desired number of characters to extract from the end of a text string.
Let’s dive into some examples to illustrate the usage of the Text.End function:
Suppose you have the text string “Hello, World” and you want to extract the last 5 characters. By utilizing the Text.End function with the text “Hello, World” and a count of 5, you will obtain “World” as the resulting extracted substring.
Text.End( "Hello, World", 5 ) // Returns "World"
Consider the phrase “Life is good.” If you need to extract the last 4 characters from this text, you can use the Text.End function with the text “Life is good” and a count of 4. This will yield “good” as the extracted substring.
Text.End( "Life is good", 4 ) // Returns "good"
In some cases, you may want to extract a longer substring from the end of a text value. For instance, if you have the text “Life is good” and want to retrieve the last 7 characters, Text.End with the text “Life is good” and a count of 7 will give you “is good” as the resulting extracted substring.
Text.End( "Life is good", 7 ) // Returns "is good"
Learn more about Text.End in the following articles:
- 3 Ways to Add Leading Zeros to Numbers in Power Query
Leading zeros help when you need a fixed value length. Yet, theycan also help when sorting text values that include numbers. This post … » Read more
Other functions related to Text.End are: