Table of Contents
A fundamental requirement in modern data analysis and effective relational database management is the sophisticated ability to compare and combine disparate datasets. Among the specialized joining operations available, the Anti Join stands out as a supremely powerful technique. It is specifically designed to isolate records that exist in a primary dataset but are conspicuously absent from a secondary dataset. Put simply, an anti join returns all rows from the primary (or left) table that fail to find a corresponding match based on the defined key in the secondary (or right) table. This exclusionary capability is indispensable for crucial tasks such as identifying data exceptions, validating data integrity, and isolating missing information across multiple data sources.
When operating within the Microsoft Power BI environment, the most streamlined and efficient path for performing an anti join between two tables is through the Merge Queries function. This function is centrally located within the powerful Power Query Editor interface. This visual tool democratizes complex data operations, making advanced techniques accessible even to users who lack extensive knowledge of SQL or M language scripting. The cornerstone of successfully executing this process lies in correctly configuring the merge parameters, specifically selecting the “Left Anti” join type, which is the mechanism that drives this critical data preparation step.

The following guide offers a comprehensive, step-by-step walkthrough demonstrating the precise execution of a Left Anti Join. We utilize a common sports data scenario to clearly illustrate how to isolate non-matching records, ensuring precision and clarity in the final transformed data output. Mastering this technique significantly enhances a user’s ability to clean, validate, and prepare data for reporting and visualization within the Power BI ecosystem.
The Theoretical Foundation of the Anti Join
Before proceeding to the implementation steps, it is essential to fully internalize the theoretical basis of the anti join. Unlike conventional joins (such as the inner or full outer joins), which are designed to combine datasets based on common keys, the anti join serves a distinct filtering purpose. It operates fundamentally as a mechanism of deliberate exclusion. When a Left Anti Join is initiated, the system systematically scrutinizes the primary table (Table A) and compares the values in its designated key column against the corresponding key column values in the secondary table (Table B). Critically, any row in Table A that successfully locates a match in Table B is immediately discarded from the resulting dataset.
The resulting output is a precise subset derived solely from the primary table. This subset contains only those records that unequivocally failed to find a correlation or existence check in the secondary table. This functionality proves invaluable across numerous data analysis contexts. Practical applications include pinpointing customers listed in a database who have yet to place an order (by comparing the customer list against an orders transaction list), or isolating inventory items that possess zero corresponding sales records. The high degree of precision offered by this exclusionary technique makes it indispensable for executing robust data quality assurance and specialized filtering tasks required throughout the data preparation and data transformation pipeline.
In Power BI, this powerful operation is executed entirely through the Merge Queries feature, which offers a selection of six distinct join types. The specific join type required for the anti join operation is officially labeled as Left Anti (rows only in first). This explicit terminology clearly defines its function: the operation is guaranteed to return only the rows originating from the ‘Left’ table that do not possess any corresponding match in the ‘Right’ table. Successfully mastering this specific merge configuration is the absolute key to performing this powerful exclusionary operation with efficiency and accuracy.
Defining the Data Scenario and Objectives
For the purpose of our practical demonstration, we assume that two related but structurally distinct tables have been imported into our Power BI model, both containing relevant basketball statistics. These tables share a common field identifier: the Team name. Our core objective is to execute a specialized transformation that isolates players present in the first dataset whose teams are not represented whatsoever in the second dataset, effectively filtering out any teams that appear in both sources.
The first table, designated data1, provides foundational metrics regarding various basketball players, including their team affiliations and the total points scored. This table is critically defined as our primary (left) table in the merge operation, as we wish to retain only the non-matching rows originating from this source.

The second table, labeled data2, contains supplementary statistics, specifically rebound counts, associated with various team names. This table will serve as the secondary (right) table, providing the essential criteria against which we check for the existence of matching team names. It acts purely as the exclusion list.

Our specific aim is to perform the Anti Join operation. We intend to retain exclusively those rows originating from the data1 table where the corresponding value in the Team column does not find a match in the Team column of the data2 table. The successful execution of this operation will generate a new table containing only the data points from teams that exist uniquely within data1, thereby isolating the desired unique or unmatched records.
Accessing and Utilizing the Power Query Environment
All sophisticated data analysis and preparation tasks in Power BI are centrally governed and managed through the Power Query Editor. To commence the anti join procedure, we must first launch this specialized environment. Begin by navigating to the Home tab situated along the main top ribbon interface of the Power BI Desktop application.
Within the Home tab, locate the section dedicated to managing and manipulating data sources and transformations. Click the Transform data icon. This immediate action will open the dedicated Power Query Editor window, which provides the workspace necessary to manipulate, clean, and merge our datasets before they are loaded for final visualization on the main Power BI report canvas.

Once inside the Power Query Editor, it is crucial to ensure that the data1 table is actively selected in the Queries pane located on the left side, as this table must serve as the primary source for our merge operation. The next step involves locating the necessary tool for combining tables, which is the Merge Queries function. This function is conveniently grouped within the Combine group found on the Home tab ribbon within the Editor.
When clicking the Merge Queries icon, a dropdown menu will present two options: “Merge Queries” (which modifies the currently selected table) or “Merge Queries as New.” For adherence to best practices in secure data transformation, it is highly recommended to select Merge Queries as New. This selection guarantees that the original source tables (data1 and data2) remain completely untouched, generating a new, distinct result table (typically named Merge1) that holds the outcome of the anti join operation.
Executing and Configuring the Left Anti Join
Initiating the merge process immediately launches the Merge dialogue box, a feature that demands careful configuration to guarantee the correct join type is applied. This box provides the facility to define both the primary (left) and secondary (right) tables, as well as the crucial common column (the join key) and the overall joining methodology.
First, verify that the top dropdown menu correctly displays data1, our primary table. Next, use the second dropdown menu to select data2 as the table against which we will merge and check for existence. The most critical step follows: specifying the join key. Click the column header for the Team column in the visual preview of the data1 table, and then simultaneously click the header for the Team column in the preview of the data2 table. The Power Query Editor utilizes this paired selection to understand which specific columns should be used to search for matching values across the two datasets.
Finally, locate the Join Kind dropdown menu. Scroll through the available options and select the specific type required: Left Anti (rows only in first). This specific selection formally directs Power BI to execute the desired exclusionary logic inherent to the Anti Join, ensuring that only rows unique to data1 are preserved in the result set.

Once the key columns are highlighted correctly and the Left Anti join type is properly selected, click OK. The Merge Queries function will immediately execute the anti join transformation. The resulting temporary table, containing the filtered data, will instantly appear in the Power Query Editor window.
Validating the Exclusion and Finalizing the Result Set
Upon the successful completion of the merge operation, the new query (which will likely be named Merge1) will contain all the original columns imported from data1, alongside a single new column titled data2. This new column holds Table values, representing the linked table from the right side of the join. Because we specifically executed an Anti Join, the table values displayed in this new data2 column will universally show Null. This consistent Null presence is the expected and desired outcome, signifying that no matching rows were successfully found in the secondary table (data2).

While the core filtering operation is complete, the final step in this data transformation pipeline involves refining the column structure. Since our primary interest was verification of exclusion, we typically do not need all columns from the secondary table. Click the expand icon (indicated by the left and right arrows) located on the header of the data2 column. This action will present an expansion menu. It is optional but cleaner to deselect the option to “Use original column name as prefix.” Then, check the box next to Rebounds, or any other column you wish to selectively include from the secondary table. In this filtering scenario, including the Rebounds column (which will only contain Null values) serves as a visual confirmation of the successful anti join filtering.

After clicking OK, the Rebounds column (or the selected column(s)) will be expanded, displaying the expected Null values corresponding to the filtered rows. This final data structure confirms definitively that only the rows originating from the initial data1 table that had no corresponding team entry in data2 have been successfully retained in the new query.

Applying Changes and Reviewing the Final Data Model
Once the Power Query Editor displays the precisely transformed table, these changes must be formally applied back to the main Power BI data model. To achieve this crucial step, click Close & Apply in the Home tab of the Power Query Editor ribbon. A message box will prompt confirmation of the intent to apply the recent changes and load the new query results into the live data model. Click Yes to confirm this action and initiate the data loading process.
Upon successful loading, the new table, named Merge1 (or any custom name you may have assigned it within the Power Query Editor), will become fully accessible in the Table view within Power BI Desktop. Users should inspect this table thoroughly to verify the exact results of the Left Anti Join operation.

Carefully observe the final merged table. It successfully contains only those rows from the initial data1 table whose Team values were entirely absent from the data2 table. This successful exclusion powerfully demonstrates the utility of the Anti Join in isolating specific, non-overlapping subsets of data for reporting. Before applying the transformation, it is often beneficial to right-click the header named data2.Rebounds in the Power Query Editor and use the Rename function to simplify the column name back to just Rebounds, ensuring a cleaner final data model structure suitable for visualization and report generation.
Advanced Data Preparation Resources for Mastery
To further enhance your expertise in meticulous data preparation and advanced data transformation using Power BI, we encourage exploring additional tutorials that cover complex data manipulation tasks and foundational concepts in data analysis:
-
How to Add Index Column to Table in Power BI
-
In-depth understanding of the critical differences between the various join types available within the Merge Queries interface.
-
Mastering advanced filtering and conditional column creation using the powerful M formula language within the Power Query Editor.
Cite this article
Mohammed looti (2025). Learning Anti Joins in Power BI: A Tutorial for Data Analysis. PSYCHOLOGICAL STATISTICS. Retrieved from https://statistics.arabpsychology.com/perform-an-anti-join-in-power-bi-with-example/
Mohammed looti. "Learning Anti Joins in Power BI: A Tutorial for Data Analysis." PSYCHOLOGICAL STATISTICS, 12 Nov. 2025, https://statistics.arabpsychology.com/perform-an-anti-join-in-power-bi-with-example/.
Mohammed looti. "Learning Anti Joins in Power BI: A Tutorial for Data Analysis." PSYCHOLOGICAL STATISTICS, 2025. https://statistics.arabpsychology.com/perform-an-anti-join-in-power-bi-with-example/.
Mohammed looti (2025) 'Learning Anti Joins in Power BI: A Tutorial for Data Analysis', PSYCHOLOGICAL STATISTICS. Available at: https://statistics.arabpsychology.com/perform-an-anti-join-in-power-bi-with-example/.
[1] Mohammed looti, "Learning Anti Joins in Power BI: A Tutorial for Data Analysis," PSYCHOLOGICAL STATISTICS, vol. X, no. Y, ص Z-Z, November, 2025.
Mohammed looti. Learning Anti Joins in Power BI: A Tutorial for Data Analysis. PSYCHOLOGICAL STATISTICS. 2025;vol(issue):pages.