Text.Upper

D

T

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

In this article, we will explore the M code behind the Text.Upper function and how it can be used to manipulate text data.

What is Text.Upper?

Text.Upper is a function in Power Query that is used to convert text to uppercase. It takes a text value as an input and returns the same text value in uppercase. For example, if the input text is “hello world”, the output of Text.Upper will be “HELLO WORLD”.

The syntax for using Text.Upper is as follows:


Text.Upper(text as nullable text) as nullable text


Understanding the M Code Behind Text.Upper

The M code behind Text.Upper is relatively simple. It consists of a single line of code that makes use of the Text.Upper function:


(Text.Upper([Text]))


This code takes an input text value and passes it to the Text.Upper function. The Text.Upper function then converts the text to uppercase and returns the result.

Let’s break down this code into its individual components:

– The outer parentheses indicate that we are creating a new expression.

– The Text.Upper function is enclosed in parentheses, indicating that it is a function call.

– The [Text] parameter is the input text value that will be converted to uppercase.

Using Text.Upper in Power Query

Now that we understand the M code behind Text.Upper, let’s take a look at how it can be used in Power Query.

Suppose we have a table of customer data that includes a column for the customer’s first name. We want to create a new column that contains the first name in uppercase. Here’s how we can do it:

1. Load the customer data into Power Query.

2. Select the first name column.

3. Click the “Add Column” tab in the ribbon.

4. Click “Custom Column”.

5. In the “Custom Column” dialog box, enter a name for the new column (e.g. “First Name Uppercase”).

6. In the “Custom Column” dialog box, enter the following formula:


Text.Upper([First Name])


7. Click “OK” to create the new column.

The result will be a new column that contains the customer’s first name in uppercase.

The Text.Upper function in Power Query is a useful tool for manipulating text data. Its simple M code makes it easy to use in a variety of data transformation scenarios. By understanding the M code behind Text.Upper, you can gain a deeper understanding of how Power Query works and how you can use it to transform your data.

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)