Table.Combine

D

T

The M Code Behind the Power Query M function Table.Combine

What is M Code?

M code is the language used by Power Query to transform and manipulate data. It is a functional language that is similar to Excel formulas, but more powerful. M code is used to create queries that bring data from various sources, transform it, and load it into a destination. You don’t need to be an expert in M code to use Power Query, but having a basic understanding of how it works can make your life easier.

What is Table.Combine?

Table.Combine is a Power Query M function that allows you to combine multiple tables into a single table. It is useful when you have multiple tables with the same schema and you want to merge them into a single table. The function takes a list of tables as input and returns a single table that contains all the rows from each table.

How does Table.Combine work?

Table.Combine works by concatenating the rows from each table into a single table. The function takes a list of tables as input and combines them into a single table by appending the rows from each table to the end of the previous table. The function ignores the column headers of each table and assumes that all tables have the same schema. If the tables have different schemas, you will need to use other functions to transform the data before using Table.Combine.

Syntax of Table.Combine

The syntax of Table.Combine is as follows:


Table.Combine(list as list)


The function takes one argument, which is a list of tables. The list can contain any number of tables, but they must all have the same schema. The function returns a single table that contains all the rows from each table.

Example of Table.Combine

Let’s look at an example of how to use Table.Combine. Suppose we have two tables, Table1 and Table2, with the same schema. We want to combine these tables into a single table. We can use the following M code to achieve this:


let

Source = {Table1, Table2},

CombinedTable = Table.Combine(Source)

in

CombinedTable


The code first creates a list of tables called Source, which contains Table1 and Table2. It then passes this list as an argument to the Table.Combine function, which returns a single table called CombinedTable. The resulting table contains all the rows from both tables.

Table.Combine is a powerful function in Power Query that allows you to combine multiple tables into a single table. It is useful when you have multiple tables with the same schema and you want to merge them into a single table. The function works by concatenating the rows from each table into a single table and assumes that all tables have the same schema. If you are new to Power Query, understanding how Table.Combine works can help you improve your data transformation skills and make your life easier.

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)