Text.StartsWith

Text

Returns true if a text value starts with a specified substring.

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

Syntax

Text.StartsWith(text as nullable text, substring as text, optional comparer as nullable function) as nullable logical

Parameters

NameTypeRequiredDescription
texttextYesThe text value to check.
substringtextYesThe substring to match at the beginning.
comparerfunctionNoA comparer function to control case sensitivity.

Return Value

logicaltrue if the text starts with the substring, false otherwise.

Remarks

Text.StartsWith checks whether a text value begins with a given substring. Like Text.Contains, the comparison is case-sensitive by default.

Examples

Example 1: Filter log entries by action prefix

Table.SelectColumns(
    Table.SelectRows(OrderLog, each Text.StartsWith([Notes], "New order")),
    {"LogID", "Action", "Notes"}
)
Result
LogID
Action
Notes
1L001CreatedNew order: Widget A
2L003CreatedNew order: Gadget B
3L005CreatedNew order: Widget C
4L007CreatedNew order: Gadget D

Compatibility

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