JoinKind.LeftSemi (6) is an enumeration that specifies the kind of join operation. It is a member of the JoinKind.Type and represents a left semi join which returns all rows from the first table that have a match in the second table.
Examples
So how can we use the JoinKind.LeftSemi enumeration? Suppose you have the following table called factOutage
:
You want to filter this table down to only keep the rows that match with the dimStore
table:
To do that, you can perform a merge starting in the factOutage
table and comparing dimStore
. Since the user interface does not (yet) support the JoinKind.LeftSemi enumeration, you can setup another join type, and adjust the code to include the left semi join. This is the code you can use:
Table.NestedJoin(
Source,
{"StoreKey"},
DimStore,
{"StoreKey"},
"DimStore.1",
JoinKind.LeftSemi
)
The result of this operation is a table that filters only matching rows (similar to an inner join). Here we only have rows for StoreKeys 2 and 4:
Even though the merge operation creates a nested table object in a new column, expanding them has no use. A Semi Join can never return values from a joined table. Expanding them will return null values, as illustrated below:
Keep in mind that you can use two notations for an enumeration. The following two are equivalent:
Table.NestedJoin(
CustomersTable,
{"CustomerID_1"},
OrdersTable,
{"CustomerID_2"},
"Orders"
JoinKind.LeftSemi // specifies the JoinKind
)
/* ----------------------------------------
You can also write the short-hand value
------------------------------------------ */
Table.NestedJoin(
CustomersTable,
{"CustomerID_1"},
OrdersTable,
{"CustomerID_2"},
"Orders"
6 // the concise way to specify the left semi join
)
Related articles
Learn more about JoinKind.LeftSemi in the following articles:
- Understanding Semi Joins in Power Query
This article explains the use of Semi Joins in Power Query. » Read more - New Semi Join, Anti Join And Query Folding Functionality In Power Query
This article introduces Semi Joins in Power Query. » Read more
Related enumerations
Other related enumerations are:
- JoinKind.FullOuter
- JoinKind.Inner
- JoinKind.LeftAnti
- JoinKind.LeftOuter
- JoinKind.RightAnti
- JoinKind.RightOuter
- JoinKind.RightSemi
Applies to
Here’s a list of functions that work with JoinKind.Type:
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy