Text.Start

Updated on

Text.Start is a Power Query M function that retrieves the first specified number of characters from a text value. The function returns a text value containing the extracted characters.

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

Syntax

Text.Start(
   text as nullable text,
   count as number,
) as nullable text

Description

Returns the first count characters of text as a text value.It allows you to specify the desired number of characters to extract from the beginning of a text string.

Examples

Let’s explore some examples to better understand the usage of the Text.Start function:

Suppose you have the text string “Hello, World” and you want to extract the first 5 characters. By using the Text.Start function with the text “Hello, World” and a count of 5, you will obtain “Hello” as the result.

Text.Start( "Hello, World", 5 )

Consider the phrase “Life is good.” If you want to extract the first 4 characters, you can utilize the Text.Start function with the text “Life is good” and a count of 4. This will yield “Life” as the extracted substring.

Text.Start( "Life is good", 4 ) // Returns "Life"

In some cases, you may need to extract a longer substring from the beginning of a text value. For instance, if you have the text “Life is good” and want to retrieve the first 7 characters, Text.Start with the text “Life is good” and a count of 7 will give you “Life is” as the result.

Text.Start( "Life is good", 7 ) // Returns "Life is"

Learn more about Text.Start in the following articles:

Other functions related to Text.Start are:

BI Gorilla Youtube Channel

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