Table of Contents
The ability to effectively manipulate and cleanse data is the cornerstone of powerful business intelligence reporting. Within the dynamic environment of Power BI, advanced data operations are managed primarily through the Power Query Editor. One particularly crucial technique for data comparison and anomaly detection is the Anti Join. Unlike traditional joins that seek matches (like Inner Joins) or include everything (like Full Outer Joins), an Anti Join performs a subtractive operation: it isolates and returns only those records from the primary dataset that fail to find a corresponding match in the secondary dataset. This fundamental technique is essential for identifying data discrepancies, highlighting outliers, or pinpointing missing relationships between two distinct tables.
Understanding how to correctly implement an Anti Join in Power BI is vital for ensuring data integrity and optimizing data models. Imagine a scenario where you have a comprehensive list of all potential products (the primary table) and a table containing only products that have been sold this quarter (the secondary table). By executing an Anti Join, you instantly generate a list of unsold products—items that exist in the first table but are absent from the second. This actionable insight allows analysts to focus marketing efforts or inventory review on specific gaps. The process is streamlined using the built-in Merge Queries function within the Power Query Editor, offering an intuitive graphical interface for advanced data manipulation without requiring extensive coding knowledge.
This detailed guide will walk you through the precise steps required to execute an Anti Join, providing context on its importance and illustrating the procedure with a practical, step-by-step example. We will ensure that the resulting output is clean, accurate, and ready for integration into your final Power BI data model. Mastering this join type significantly enhances your toolkit for data auditing and business process optimization.
Perform an Anti Join in Power BI (With Example)
Defining the Anti Join Concept
The concept of an Anti Join is foundational in relational data management. Fundamentally, it serves as a powerful filter designed to isolate unmatched records. Specifically, when merging two tables, A (the left table) and B (the right table), the Anti Join returns all rows from Table A for which there is absolutely no corresponding value found in Table B, based on the specified key columns. It is crucial to distinguish this operation from other join types, such as the Left Outer Join. While a Left Outer Join includes all rows from the left table and fills non-matching entries from the right table with nulls, the Anti Join aggressively discards records that have matches, focusing solely on the discrepancies.
In the context of Power BI Desktop, executing this operation is surprisingly straightforward, relying heavily on the intuitive capabilities of the Power Query Editor. The easiest and most reliable method involves utilizing the built-in Merge Queries functionality. This functionality provides a graphical user interface that abstracts away the complexity of writing custom M language code, making advanced data transformation accessible to a wide audience of analysts and data professionals. Whether you are searching for customers who haven’t engaged in a promotional campaign or products that lack necessary metadata, the Anti Join is the specialized tool for the task.
Leveraging the Merge Queries dialogue box allows users to define the primary (left) table, the secondary (right) table, the joining keys, and, most importantly, the specific join kind. For an Anti Join, this option is explicitly labeled as “Left Anti” or “Right Anti,” depending on which table’s unmatched records you wish to preserve. The resultant query forms a new table containing the precise subset of data representing the gaps between the two original datasets. Understanding the directionality—Left Anti vs. Right Anti—is paramount, as it dictates which table serves as the source of the returned records.
An anti join allows you to return all rows in one table that do not have matching values in another table.
The easiest way to perform an anti join between two tables in Power BI is to use the Merge Queries function in the Power Query Editor.

Setting the Stage: Data Preparation and Context
To fully illustrate the powerful application of the Anti Join, we will work through a concrete example involving sports data. This scenario perfectly mimics real-world data environments where analysts frequently need to compare metrics across different organizational units or track performance against predefined lists. Our goal is to identify basketball teams present in one dataset (containing points scored) that are entirely absent from a second dataset (containing rebound statistics), based solely on the ‘Team’ identifier.
We begin with two distinct tables loaded into the Power BI data model. The first table, named data1, acts as our primary, or left, table. It contains essential attributes for various players, specifically tracking their respective Team affiliation and the total Points they have scored. This table represents the comprehensive list from which we wish to exclude matched records.
The second table, named data2, serves as the secondary, or right, table. This table includes information related to the same teams, but focuses on a different metric: Rebounds. The key identifier linking these tables is the Team column. Our subsequent task is to use the Anti Join operation to filter data1, retaining only the teams that exist in data1 but do not appear anywhere in data2, thus revealing missing data points or transactional gaps.
The following example shows how to do so in practice.
Suppose we have the following table in Power BI named data1 that contains information about the team name and points scored for various basketball players:

And suppose that we have another table named data2 that contains information about the team name and rebounds for various basketball players:

Initiating the Merge Operation in Power Query Editor
The entire joining and transformation process must occur within the Power Query Editor, which is the dedicated environment for data shaping and data manipulation in Power BI. Accessing this editor is the first critical step after loading the source data. Analysts typically navigate to the Home tab of the main Power BI Desktop ribbon and select the Transform data option (often represented by a small icon resembling a table with an arrow). This action immediately launches the separate Power Query Editor window, providing access to extensive tools for cleansing and modeling the datasets.
Once inside the Power Query Editor, the process of combining tables begins by selecting the primary table (data1, in our example) from the list of queries on the left panel. The next step is to initiate the Merge Queries command. This command is located within the Combine group on the Home tab of the Power Query Editor ribbon. For best practice, and especially when performing destructive filtering like an Anti Join, it is highly recommended to select Merge Queries as New from the dropdown menu. This preserves the original source tables (data1 and data2) unchanged and creates a completely new query containing the joined results, thereby maintaining auditability and simplifying troubleshooting.
The selection of Merge Queries as New opens the dedicated dialogue box where the analyst defines the parameters of the join. Within this dialogue, the top selection box automatically defaults to the currently selected table (data1, the Left Table), and the analyst must explicitly choose the second table (data2, the Right Table) from the provided dropdown menu. Establishing this left-to-right relationship is fundamental, as it defines the directionality of the subsequent Left Anti Join filter.
Suppose that we would like to perform an anti join in which we only keep the rows from data1 that do not have matching values in the Team column in the data2 table.
To do so, click the Home tab along the top ribbon, then click the Transform data icon:

This will bring up the Power Query Editor.
Next, click the Merge Queries icon in the Combine group of the Home tab.
Then click Merge Queries as New from the dropdown menu:

Specifying Join Keys and Selecting the Left Anti Join Type
The core requirement for any successful join operation is the designation of the joining keys—the columns that contain the common values used to establish the relationship between the two tables. In our example, both data1 and data2 share the Team column, which serves as the unique identifier for each record comparison. In the Merge Queries dialogue box, the analyst must click on the header of the Team column in the preview window for the Left Table (data1) and then simultaneously click the header of the Team column in the preview window for the Right Table (data2). Power BI visually confirms the selection by highlighting the chosen columns, often with a numerical indicator if multiple keys are used.
Immediately following the selection of the key columns, the most critical configuration step for the Anti Join is the selection of the correct Join Kind. Within the dropdown menu labeled “Join Kind,” the user must select Left Anti (rows only in first). This explicit selection instructs the Merge Queries function to perform the subtractive logic: retain all rows from the Left Table (data1) that have zero matches in the Right Table (data2) based on the specified Team key. This is the mechanism that precisely executes the desired Anti Join function.
Once the key columns are designated and the Left Anti join kind is selected, the dialogue box provides a useful indicator at the bottom confirming how many rows from the Left Table will match or, in this case, how many will be excluded due to matching. After confirming these parameters—ensuring data1 is the left table, data2 is the right table, Team is the linking key, and Left Anti is the type—the analyst clicks OK. This action executes the join and generates the preliminary result within the Power Query Editor, typically producing a new query named “Merge1.”
Then click the header for the Team column in each table so that Power BI knows to use those columns for the join:

Once you click OK, the anti join will be performed:

Processing the Results and Expanding Columns
The immediate result of the Anti Join operation (Merge1) is a filtered version of the Left Table (data1), containing only the unmatched rows. Notice in the preview window that the resulting table still contains the original columns from data1 (Team and Points), but the final column, corresponding to the merged table (data2), contains the label “Table.” This “Table” value signifies that for every row preserved by the Anti Join filter, there were no matching rows found in the secondary table (data2). Had matches been found, those rows would have been filtered out entirely. This “Table” column confirms the successful exclusion of matched data.
Although the primary function of the Anti Join is often just to identify the unmatched records from the Left Table, it is sometimes necessary to include select columns from the Right Table as reference, even if they contain nulls. To complete the operation, the analyst must expand the column containing the nested table structure (labeled data2). This is done by clicking the expand icon—the two opposing arrows—located on the header of the merged column.
In the expansion dialogue box that appears, the analyst controls which columns from the Right Table (data2) should be projected into the final result. In our example, if we wished to see the Rebounds column from data2, we would check the box next to Rebounds. It is critical to deselect the option to use the original column name as a prefix if the column name is descriptive enough (or rename it later). However, since this is an Anti Join, any expanded column from data2 will strictly contain null values for every row, as the definition of the Anti Join is that no matches existed. Expanding the column serves mainly to confirm the absence of data or to prepare the data structure for subsequent transformations.
Next, click the left and right arrows on the header of the data2 column. Then check the box next to Rebounds to indicate that this column should be the only one included from data2 in the final merged table:

Once you click OK, the Rebounds column will be shown from the data2 table:

Finalizing the Transformation and Applying Changes
After the columns have been expanded and the resulting table structure is satisfactory within the Power Query Editor, the data manipulation phase is complete. The remaining steps involve ensuring these transformations are applied to the primary Power BI data model. Before exiting the editor, the analyst can optionally rename the resulting query (e.g., from “Merge1” to “Unmatched Teams”) for clarity. Furthermore, if the expanded column header is redundant (e.g., “data2.Rebounds”), a quick right-click on the header allows for renaming it to a simpler term like “Rebounds,” enhancing readability for future reports and data consumers.
To push the newly created and filtered table into the main data model, the analyst navigates back to the Home tab of the Power Query Editor and selects Close & Apply. If the editor detects unsaved changes, a confirmation message box will appear, asking if the user wishes to apply the pending transformations. Selecting Yes initiates the loading process, where the M language script developed during the merge operation is executed, and the final dataset is loaded into the Power BI environment.
Once the changes are successfully applied, the analyst can view the new table in the Table view of Power BI Desktop. The table, now named Merge1 (or the custom name assigned), perfectly embodies the result of the Left Anti Join. It contains only the rows from the original data1 that had no match in data2 based on the Team column. This resultant table now represents the critical data points—the outliers, discrepancies, or missing information—that the analyst was attempting to isolate, providing targeted insights ready for visualization and reporting.
Once you exit out of the Power Query Editor, a message box will appear that asks if you’d like to apply your changes.
Click Yes.
You will then be able to see the new table named Merge1 in the Table view:

Notice that this final merged table contains all rows from the data1 table that did not have matching values in the Team column of the data2 table.
Note: If you’d like, you can right click on the header named data2.Rebounds and rename the column to just Rebounds.
Practical Applications and Use Cases for Anti Joins
The utility of the Anti Join extends far beyond simple database comparison; it is a fundamental tool for data validation, quality assurance, and critical business analysis across numerous domains. Unlike set operations that might only provide a count of unmatched records, the Anti Join provides the granular data points themselves, allowing for immediate corrective action.
Common real-world applications include:
- Sales and Marketing Gap Analysis: Identifying customers in the main customer relationship management (CRM) database who have not yet appeared in the sales transactions log. This list of non-purchasers is critical for targeted outreach and churn prevention strategies.
- Inventory Management: Finding products listed in the master product catalog that have never been assigned a supplier or stock location, indicating incomplete metadata or administrative oversights.
- Data Quality and Auditing: Locating records in a fact table (e.g., transactions) that refer to keys missing from a dimension table (e.g., employees). These records represent orphaned data, highlighting referential integrity issues that need immediate correction to ensure report accuracy.
- Security and Access Control: Determining which authorized users on a master list have not logged in within a specific time frame, aiding in security policy audits and license optimization.
In essence, whenever an analyst needs to identify the complement—the missing piece or the exception to the rule—the Anti Join proves to be the most efficient and robust method available in the Power Query Editor. It transforms complex logical queries into a simple, graphical merge operation.
Summary of Anti Join Benefits and Alternatives
The Anti Join stands out in the suite of join types offered in Power BI due to its surgical precision in gap identification. By isolating non-matching records, it provides immediate, actionable data for business improvement. While it is the most direct approach for this purpose, it is important to acknowledge that there are alternative methods, particularly using DAX (Data Analysis Expressions) or custom M code filtering, but these often introduce greater complexity and performance overhead compared to the standard Merge Queries implementation.
Using DAX, for instance, one might achieve a similar result using functions like EXCEPT or by filtering a table where related column values are ISBLANK. However, such methods typically operate after the data has been loaded into the model, whereas the Anti Join in Power Query Editor performs the critical data cleansing and transformation step upstream, leading to a smaller, cleaner, and more efficient data model. This principle—performing transformations as early as possible—is central to high-performance Power BI development.
In conclusion, the Anti Join is an indispensable technique for any data professional working with Power BI. It transforms the challenge of finding discrepancies into a simple selection within the Merge Queries dialogue box. By following the clear steps outlined above—defining the Left and Right tables, selecting the common key, and choosing the Left Anti join kind—you can swiftly and accurately isolate the data that matters most for auditing and gap analysis.
Further Learning and Related Topics
To continue building expertise in Power BI and advanced data transformation, we recommend exploring related tutorials that delve deeper into data modeling and query optimization techniques. Mastering joins is just one component of effective data preparation.
Topics closely related to the effective use of Anti Joins include:
- Understanding the M language and custom function creation in the Power Query Editor.
- Implementing proper key column selection to handle composite keys or fuzzy matching scenarios.
- Optimizing query folding to ensure performance when connecting to large relational databases.
The following tutorials explain how to perform other common tasks in Power BI:
Cite this article
stats writer (2026). How to Perform an Anti Join in Power BI to Find Data Discrepancies. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-do-you-perform-an-anti-join-in-power-bi-and-can-you-provide-an-example/
stats writer. "How to Perform an Anti Join in Power BI to Find Data Discrepancies." PSYCHOLOGICAL SCALES, 25 Jan. 2026, https://scales.arabpsychology.com/stats/how-do-you-perform-an-anti-join-in-power-bi-and-can-you-provide-an-example/.
stats writer. "How to Perform an Anti Join in Power BI to Find Data Discrepancies." PSYCHOLOGICAL SCALES, 2026. https://scales.arabpsychology.com/stats/how-do-you-perform-an-anti-join-in-power-bi-and-can-you-provide-an-example/.
stats writer (2026) 'How to Perform an Anti Join in Power BI to Find Data Discrepancies', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-do-you-perform-an-anti-join-in-power-bi-and-can-you-provide-an-example/.
[1] stats writer, "How to Perform an Anti Join in Power BI to Find Data Discrepancies," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, January, 2026.
stats writer. How to Perform an Anti Join in Power BI to Find Data Discrepancies. PSYCHOLOGICAL SCALES. 2026;vol(issue):pages.
