Text.AfterDelimiter

Text

Returns the portion of a text value after a specified delimiter, optionally specifying which occurrence to use.

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

Syntax

Text.AfterDelimiter(text as nullable text, delimiter as text, optional index as any) as nullable text

Parameters

NameTypeRequiredDescription
texttextYesThe source text value.
delimitertextYesThe delimiter string to search for.
indexanyNoA zero-based occurrence index (number) or a two-item list {index, RelativePosition.FromEnd} to count from the end. Defaults to 0 (first occurrence).

Return Value

textThe text after the specified occurrence of delimiter.

Remarks

Text.AfterDelimiter returns all text that follows the specified delimiter occurrence. By default it finds the first occurrence (index 0) and returns everything after it, including any subsequent instances of the delimiter.

The index parameter offers two forms of occurrence control: - A non-negative integer n: the zero-based occurrence index (0 = first, 1 = second, etc.) - A two-element list {n, RelativePosition.FromEnd}: count n occurrences from the end of the string, where {0, RelativePosition.FromEnd} means the last occurrence

If the delimiter is not found in the text, an empty string is returned — not an error. This means you should validate the result when a missing delimiter indicates a data quality issue. If text is null, the function returns null.

This function is generated by the Power Query UI's "Extract > Text After Delimiter" option. It is the complement of Text.BeforeDelimiter. For extracting content between two delimiters, use Text.BetweenDelimiters. These delimiter functions do not accept a comparer parameter — the delimiter search is always case-sensitive. If you need case-insensitive delimiter matching, use Text.PositionOf with Comparer.OrdinalIgnoreCase and then Text.Middle.

Examples

Example 1: Extract the portion after the first delimiter

Text.AfterDelimiter("US-WA-Seattle", "-")
Result
Result
1WA-Seattle

Example 2: Extract text after the second occurrence

Text.AfterDelimiter("US-WA-Seattle", "-", 1)
Result
Result
1Seattle

Example 3: Extract the last segment using RelativePosition.FromEnd

Text.AfterDelimiter("Sales/East/Q1/Alice", "/", {0, RelativePosition.FromEnd})
Result
Result
1Alice

Example 4: Extract email domain from an address column

Table.AddColumn(
    #table({"Email"}, {{"alice@example.com"}, {"bob@contoso.com"}}),
    "Domain",
    each Text.AfterDelimiter([Email], "@")
)
Result
Email
Domain
1alice@example.comexample.com
2bob@contoso.comcontoso.com

Compatibility

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