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
Syntax
Text.End(
text as nullable text,
count as number,
) as nullable text
Description
Returns a text
value that is the last count
characters of the text
value text
. It enables you to specify the desired number of characters to extract from the end of a text string.
Examples
Let’s look at some examples to illustrate the usage of the Text.End function:
Imagine you have the text string “Hello, World” and you want to get the last 5 characters. Using the Text.End
function with “Hello, World” and a count of 5 will give you “World”.
Text.End( "Hello, World", 5 ) // Returns "World"
Now, think about the phrase “Life is good.” If you need to get the last 4 characters, you can use the Text.End
function with “Life is good” and a count of 4. This will return “good”.
Text.End( "Life is good", 4 ) // Returns "good"
Sometimes, you might want to get a longer part of the text from the end. For example, if you have “Life is good” and you want the last 7 characters, using Text.End
with “Life is good” and a count of 7 will give you “is good”.
Text.End( "Life is good", 7 ) // Returns "is good"
Related articles
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, they can also help when sorting text values that include numbers. This post … » Read more
Related functions
Other functions related to Text.End are:
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy