RowExpression.Column

D

T

The M Code Behind the Power Query M function RowExpression.Column

What is RowExpression.Column Function?

The RowExpression.Column function is a part of the M language and is used to extract the value of a column from a table. The function takes two arguments – the first argument is the table, and the second argument is the name of the column. The function returns a list of values from the specified column.

The M Code Behind RowExpression.Column Function

The RowExpression.Column function is implemented in the M language as follows:


(table as table, column as text) as list =>

Table.Column(table, column)


The function takes two parameters - table and column. The first parameter is of the type “table,” which is the table from which you want to extract the column. The second parameter is of the type “text,” which is the name of the column you want to extract.

The function returns a list of values from the specified column using the Table.Column function. The Table.Column function takes two arguments - the first argument is the table, and the second argument is the name of the column. The function returns a list of values from the specified column.

How to Use RowExpression.Column Function?

The RowExpression.Column function can be used to extract a single column or multiple columns from a table. Here are a few examples:

Extracting a Single Column

To extract a single column from a table, you can use the following syntax:


= Table.AddColumn(#”Previous Step”, “Column Name”, each RowExpression.Column([Table Name], “Column Name”))


In this syntax, the “Previous Step” refers to the previous step in the Power Query Editor. The “Column Name” refers to the name of the column you want to extract. The “Table Name” refers to the name of the table you want to extract the column from.

Extracting Multiple Columns

To extract multiple columns from a table, you can use the following syntax:


= Table.AddColumn(#”Previous Step”, “Column Name”, each List.Combine({List.Transform({“Column Name 1”, “Column Name 2”}, each RowExpression.Column([Table Name], _))}))


In this syntax, the “Column Name 1” and “Column Name 2” refer to the names of the columns you want to extract. The “Table Name” refers to the name of the table you want to extract the columns from.

In this article, we explored the M code behind the RowExpression.Column function in Power Query. We learned that the function is used to extract the value of a column from a table. We also learned how to use the function to extract a single column or multiple columns from a table. By leveraging the power of the RowExpression.Column function, you can perform complex data transformations quickly and easily in Power Query.

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)