Text.Start

Text

Returns a text value of the specified length from the start of a text value.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

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

Parameters

NameTypeRequiredDescription
texttextYesThe source text value.
countnumberYesThe number of characters to return from the start of the text.

Return Value

textThe first count characters of text.

Remarks

Text.Start extracts a substring from the beginning of a text value, returning the first count characters. It is the left-side counterpart to Text.End, and together they cover the most common fixed-length extraction patterns from the edges of a string.

If text is null, the function returns null. If count is greater than the length of text, the entire text is returned without error — there is no out-of-bounds exception. If count is 0, an empty string "" is returned.

Use Text.Start when the prefix has a known, fixed length. When the prefix is delimited by a separator character at a variable position, use Text.BeforeDelimiter instead — it is more robust when the delimiter position changes across rows. For extracting from the middle of a string, use Text.Middle or Text.Range.

Text.Start(text, n) is exactly equivalent to Text.Range(text, 0, n) and Text.Middle(text, 0, n), but Text.Start expresses intent more clearly when extracting a prefix.

Examples

Example 1: Extract a fixed-length prefix from an employee ID

Text.Start("E001", 1)
Result
Result
1E

Example 2: Extract the year from a hire date stored as text

Text.Start("2021-03-15", 4)
Result
Result
12021

Example 3: Truncate long department names to a maximum length

Table.TransformColumns(
    #table({"Department"}, {{"Sales"}, {"Engineering"}, {"Marketing"}}),
    {{"Department", each Text.Start(_, 7), type text}}
)
Result
Department
1Sales
2Enginee
3Marketi

Example 4: Count exceeds text length — entire text returned

Text.Start("East", 10)
Result
Result
1East

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks