Text.Start

D

T

The M Code Behind the Power Query M function Text.Start

Syntax

The syntax for the Text.Start function is as follows:


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


The first argument, `text`, is the text string from which you want to extract characters. The second argument, `count`, is the number of characters you want to extract from the beginning of the text string.

Example

Let’s say we have a table named `Sales` with a column named `Product Name`. We want to create a new column named `Short Name` that contains the first two characters of the product name. We can use the Text.Start function to achieve this as follows:


= Table.AddColumn(Sales, "Short Name", each Text.Start([Product Name], 2))


This will create a new column named `Short Name` in the `Sales` table with the first two characters of the `Product Name` column.

How it Works

The Text.Start function takes two arguments: `text` and `count`. The `text` argument is the text string from which you want to extract characters, and the `count` argument is the number of characters you want to extract from the beginning of the text string.

When the Text.Start function is called, it returns a new text string that contains the first `count` characters of the `text` argument.

The Text.Start function is a powerful tool in the M language that can be used to extract a specified number of characters from the beginning of a text string. It is a useful function for data transformation and manipulation tasks in Power Query. When used in conjunction with other M functions, it can help you quickly and easily transform your data to meet your needs.

Power Query and M Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)