How to Compare Two Tables in Power BI

Cody Schneider8 min read

Comparing two tables to find differences, matches, or missing items is a fundamental task in data analysis. Whether you're trying to identify which customers from last month didn't make a purchase this month or reconcile two different sales reports, Power BI gives you powerful ways to get it done. This article will show you two practical methods for comparing tables: one using the Power Query Editor and the other using DAX functions.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Why Compare Tables in Power BI?

Before jumping into the "how," it's helpful to understand the "why." Comparing tables isn't just a technical exercise, it's about uncovering valuable business insights. Here are a few common scenarios where you might need to compare two lists of data:

  • Sales and Customer Analysis: Finding new customers, identifying customers who haven't returned (churn), or comparing sales figures between two periods (e.g., this year vs. last year).
  • Data Reconciliation: Comparing a report from your CRM (like Salesforce) to a report from your accounting software to find discrepancies in sales data.
  • Inventory Management: Matching a list of products shipped against a list of products ordered to find incomplete or mismatched orders.
  • Marketing Campaigns: Comparing a list of leads generated from a specific campaign against your master customer list to see how many are new to your business.

In each case, the goal is the same: find what's changed, what's new, what's missing, or what simply doesn't match up. Now, let's look at how to do this in Power BI.

Method 1: Using the Power Query Editor to Merge Tables

The Power Query Editor is your go-to tool for shaping and preparing your data before it loads into Power BI's reporting view. It’s perfect for comparing tables to identify matches and mismatches at the row level. The primary feature we'll use here is Merge Queries.

Merging combines two tables based on a common column, much like a VLOOKUP in Excel but far more powerful and flexible. The key to merging is understanding "Join Kinds."

Understanding Join Kinds

When you merge, Power BI asks you what type of join you want to perform. Here's a quick, non-technical rundown of the most useful ones for comparison:

  • Left Anti: Shows you rows from the first table that have no match in the second table. (e.g., "Show me the customers from last month who are NOT in this month's list.")
  • Right Anti: Shows you rows from the second table that have no match in the first table. (e.g., "Show me the new customers from this month who were NOT on last month's list.")
  • Full Outer: Shows you all rows from both tables, matched up where possible. This is excellent for seeing the complete picture: what matched, what's unique to the first table, and what's unique to the second table, all in one view.
  • Inner: Shows you only the rows that match in both tables. (e.g., "Show me only the customers who bought something both this month AND last month.")
GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Step-by-Step Guide: Finding New vs. Churned Customers

Let's walk through an example. Imagine you have two tables: Sales_January and Sales_February. Each table contains a list of customer emails who made a purchase in that month. We want to find which customers are new in February and which ones "churned" (didn't return from January).

Step 1: Open the Power Query Editor

First, load your two tables into Power BI Desktop. Then, from the Home ribbon, click Transform Data to open the Power Query Editor.

Step 2: Choose the "Merge Queries" Option

In the Power Query Editor, you'll see your two tables listed in the Queries pane on the left. Select the Sales_January table. Now, go to the Home ribbon within the editor and click the Merge Queries button. Choose Merge Queries as New to create a new, combined table instead of altering your original one.

Step 3: Configure the Merge

A new window will pop up. Here’s what to do:

  1. Your first table (Sales_January) will already be selected at the top.
  2. In the dropdown below it, select your second table (Sales_February).
  3. Now, you need to tell Power BI which column to match on. Click on the Customer Email column in the top table, then click the Customer Email column in the bottom table. The columns will be highlighted.
  4. For the Join Kind, select Full Outer. This will bring in all records from both tables.
  5. Click OK.

You now have a new table. The final column will be named after your second table (Sales_February) and will contain table-like objects. This is where the magic happens.

Step 4: Expand the New Column to Find Differences

Click the expand icon in the header of that new Sales_February column. Uncheck all columns except Customer Email and also uncheck the "Use original column name as prefix" box. Click OK.

Now you have a single table with two email columns: Customer Email (from January) and Sales_February.Customer Email. You can easily spot the differences:

  • If a row has a null value in the Sales_February.Customer Email column, that customer purchased in January but not in February. They are churned customers.
  • If a row has a null value in the Customer Email column (the one from January), that customer purchased in February but not in January. They are new customers.

You can now use Power Query's filtering tools to filter out nulls and create separate tables for new, churned, and returning customers. When you're done, click Close & Apply to load your analysis into Power BI.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Method 2: Using DAX Functions for Comparison

Using the Power Query Editor is great for prepping a final, static table. But what if you want more dynamic, calculation-based comparisons in your reports? That's where DAX (Data Analysis Expressions) comes in.

DAX operates on tables that have already been loaded into your Power BI data model. Instead of physically combining tables, you create calculated columns or measures that "look into" other tables to check for values.

Using DAX to Check for Matches

Let's stick with our customer example. We have our two tables, Sales_January and Sales_February, loaded into the model. Instead of merging them, we'll create a calculated column in the Sales_January table to check if each customer also appears in Sales_February.

There are a few ways to do this in DAX, but one of the most flexible is combining the COUNTROWS and FILTER functions.

Step-by-Step Example using a Formula column

Step 1: Go to the Data View

In your Power BI Desktop file, click on the Data icon in the left-hand navigation pane to go into the Data View.

Step 2: Create a New Calculated Column

Select the Sales_January table. Go to the Column tools ribbon at the top and click New Column. A formula bar will appear, ready for you to input your DAX formula.

Step 3: Write the DAX Formula

We want to count how many times each customer email from Sales_January appears in the Sales_February table. If the count is greater than zero, they are a returning customer.

Type the following formula into the formula bar and press Enter:

Is_Returning_Customer = 
VAR CurrentCustomerEmail = Sales_January[Customer Email]
RETURN
    IF(
        COUNTROWS(
            FILTER(
                Sales_February,
                Sales_February[Customer Email] = CurrentCustomerEmail
            )
        ) > 0,
        "Yes",
        "No"
    )
Step 4: Understand the Formula

Let’s break down what this DAX formula is doing:

  • VAR CurrentCustomerEmail = Sales_January[Customer Email]: This creates a variable that stores the customer email for the current row we are evaluating in the Sales_January table.
  • FILTER(Sales_February, Sales_February[Customer Email] = CurrentCustomerEmail): This part scans the entire Sales_February table and creates a temporary, filtered version of it that only includes rows where the email matches the email of the current customer from the January table.
  • COUNTROWS(...): This simply counts the rows in that temporary filtered table. If the customer exists in the February table, the count will be 1 (or more, if they had multiple purchases). If they don't exist, the count will be 0.
  • IF(... > 0, "Yes", "No"): This final part checks the count. If it's greater than 0, it labels the customer as "Yes" (they returned). Otherwise, it labels them as "No" (they churned).

You can now use this new "Is_Returning_Customer" column to easily filter your visuals and reports in Power BI to see how many customers from January came back in February.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Which Method Should You Use?

Both methods get the job done, but they're suited for different situations.

  • Use Power Query (Merging) when:
  • Use DAX (Calculated Columns/Measures) when:

Final Thoughts

Effectively comparing tables in Power BI is all about choosing the right tool for the job. Power Query's Merge feature is your best friend when it comes to structurally preparing your data and identifying mismatched rows, while DAX offers the flexibility to create dynamic calculations that compare values across tables live in your reports. Mastering both methods will significantly enhance your ability to derive meaningful insights from your data.

Of course, this process can still feel like a bit of a maze if you're not deeply familiar with Power BI's syntax. We built Graphed to bypass these complexities entirely. Imagine instead of configuring joins or writing DAX, you could simply connect your data sources and ask questions like, "Show me a list of customers from last month who didn't buy this month" or "Compare revenue in January vs. February." Graphed generates these analyses for you instantly, allowing you to focus on the insights, not the technical setup.

Related Articles

How to Enable Data Analysis in Excel

Enable Excel's hidden data analysis tools with our step-by-step guide. Uncover trends, make forecasts, and turn raw numbers into actionable insights today!