Text.BeforeDelimiter Function in Power Query

The Text.BeforeDelimiter function returns the portion of text before the specified delimiter.

Syntax

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

Example: Get the portion of the text before the (first) hyphen.

Power Query M

let
    Source = Text.BeforeDelimiter("Ashish-Haryana-India", "-")
in
    Source 

The output of the above code is “Ashish”.