JoinKind.LeftAnti

JoinKind.LeftAnti (4) is an enumeration that specifies the kind of join operation. It is a member of the JoinKind.Type and represents a left anti join which returns all rows from the first table that do not have a match in the second table.

Imagine this – you’re joining the ‘Left Table’ and the ‘Right Table’ on a common column. The image below shows how a ‘left anti join’ works. In this case, you get a new table that includes only the elements from the ‘Left Table’ that do not have any matches in the ‘Right Table’. Any rows from the ‘Left Table’ that have matching rows in the ‘Right Table’ are excluded.

Left Anti Join in Power Query M

Examples

The left anti join returns all rows in Table1, not available in Table2. To specify the left anti join operation for the Table.NestedJoin function you can use its 6th argument.

= Table.NestedJoin(
      CustomersTable,
      {"CustomerID_1"},
      OrdersTable,
      {"CustomerID_2"},
      "Orders"           
      JoinKind.LeftAnti // specifies the JoinKind
  )

/* ----------------------------------------
    You can also write the short-hand value
 ------------------------------------------ */

= Table.NestedJoin(
      CustomersTable,
      {"CustomerID_1"},
      OrdersTable,
      {"CustomerID_2"},
      "Orders"           
      4                   // the concise way to specify the left anti join
  )

Learn more about JoinKind.LeftAnti in the following articles:

  • Join Types in Power Query
    Power Query has different join types for merging queries. Mastering them allows you to easily retrieve new values, keep relevant ones or discard them.. » Read more

Other related enumerations are:

Applies to

Here’s a list of functions that work with JoinKind.Type:

BI Gorilla Youtube Channel

Last update: August 17, 2023 | Contribute » | Contributors: Rick de Groot
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.