RowExpression.From

D

T

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

What is Power Query M?

Power Query M is a programming language used in Power Query, a data transformation and analysis tool used in Microsoft Excel and Power BI. It is a functional language that is used to perform data transformations and create custom functions.

RowExpression.From

The RowExpression.From function is used to create a new row expression. It takes two arguments: a list of column names and a list of expressions. The column names are used to define the columns of the new row expression, and the expressions are used to define the values of the columns.

Here is an example of the RowExpression.From function:


RowExpression.From({“Name”, “Age”, “Gender”}, {“John Doe”, 30, “Male”})


This function creates a new row expression with three columns: Name, Age, and Gender. The values of these columns are "John Doe", 30, and "Male", respectively.

Understanding the M Code

The M code behind the RowExpression.From function is relatively simple. Here is the M code for the function:


let

CreateRow = Record.FromList,

Result = CreateRow(columns, values)

in

Result


The M code defines two variables: CreateRow and Result. The CreateRow variable is used to create a new record from a list, and the Result variable is used to create a new row expression using the CreateRow variable.

The Record.FromList function is used to create a new record from a list. It takes two arguments: a list of column names and a list of values. The column names are used to define the columns of the record, and the values are used to define the values of the columns.

Here is an example of the Record.FromList function:


Record.FromList({“Name”, “Age”, “Gender”}, {“John Doe”, 30, “Male”})


This function creates a new record with three fields: Name, Age, and Gender. The values of these fields are "John Doe", 30, and "Male", respectively.

The Result variable uses the CreateRow variable to create a new row expression. It takes two arguments: the columns of the row expression and the values of the row expression.

The RowExpression.From function is a powerful tool in Power Query M. It is used to create new row expressions, which are formulas for creating new rows of data. The M code behind the function is relatively simple, consisting of two variables that create a new record and a new row expression. By understanding the M code behind the RowExpression.From function, you can create your own custom functions and perform data transformations with ease.

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)