Examples
M Join Query
Joining Customer Data
M join query merges customer and order tables with Table.Join.
Introduction to M Join Queries
M Join Queries are a powerful feature of the M language, commonly used in Power Query, to combine rows from two or more tables based on related columns. In this tutorial, we'll explore how to use Table.Join
to merge customer and order tables efficiently.
Understanding Table.Join
The Table.Join
function in M allows you to merge two tables into one. It operates by matching rows based on specified key columns from each table. This is particularly useful in data transformation and analysis tasks where you need to consolidate information from different sources.
Basic Syntax of Table.Join
The parameters of Table.Join
are as follows:
- table1: The primary table to join.
- key1: The column(s) in the first table to match on.
- table2: The secondary table to join.
- key2: The column(s) in the second table to match on.
- joinKind: (Optional) Specifies the type of join (e.g., InnerJoin, LeftOuter, RightOuter, etc.).
Example: Merging Customer and Order Tables
Assume you have two tables, Customers
and Orders
. You want to merge these tables based on a common column, CustomerID
. Here's how you can achieve this using Table.Join
.
In this example, we're performing an inner join on CustomerID
. The resulting table, MergedTable
, will contain all customers and their corresponding orders, including columns from both the Customers
and Orders
tables.
Examples
- Previous
- Pivot Query
- Next
- Dynamic Filter Query