How to Link Two Datasets in Power BI

Cody Schneider9 min read

Building a report with a single dataset is easy, but real insights come when you connect different sources to see the bigger picture. If you've ever tried to figure out which marketing campaigns actually resulted in sales, you know that the data lives in separate places. This guide will show you exactly how to link two datasets in Power BI to create unified, insightful reports.

Why Link Datasets in Power BI?

Your business data is rarely stored in one perfect, all-knowing file. It's scattered across different systems and spreadsheets. Your sales data might be in a Salesforce export, your digital ad performance in a Google Ads report, and your website traffic in Google Analytics.

By linking these datasets, you can move beyond isolated metrics and answer more significant questions, such as:

  • Connecting Marketing Spend to Revenue: By linking your Facebook Ads campaign data with your Shopify sales data, you can see exactly which ads are driving purchases and calculate your true return on ad spend (ROAS).
  • Understanding the Full Customer Journey: Combine lead information from a CRM like HubSpot with support ticket data from Zendesk to analyze how customer service interactions impact long-term customer value.
  • Creating a Complete Operational View: Link inventory data from one spreadsheet with sales data from another to forecast demand and manage stock levels more effectively.

Doing this transforms your reports from simple scorecards into powerful decision-making tools that tell a complete story.

Understanding the Basics: Relationships vs. Merging

Power BI gives you two primary ways to connect your data: creating relationships and merging queries. They accomplish similar goals but in fundamentally different ways.

  • Relationships (The Recommended Method): This is the standard, most efficient way to connect tables in Power BI. You create a logical link between two tables using a common column. The tables remain separate, but Power BI knows how they relate. When you drag fields from both tables into a visual, it automatically filters and aggregates the data correctly in the background. Think of it as introducing two friends who know the same person - they stay separate individuals but can be brought together through that common connection.
  • Merging Queries: This approach, done in the Power Query Editor, physically combines two tables into a single, new table. You choose one table, merge it with another based on a common column, and then select which columns from the second table you want to add to the first. It's like combining two spreadsheets into one master sheet by copying and pasting columns. While useful for certain data cleanup tasks, it can create large, inefficient tables if overused.

For most reporting, creating relationships in the Model view is the best practice. We’ll cover that first.

Before You Start: Prepare Your Data for Linking

Whether you’re creating a relationship or merging, you can’t connect two datasets that have nothing in common. The magic ingredient is a common column, often called a "key."

A common column is a field that exists in both of your datasets and contains identical values. This is how Power BI knows that a specific row in Table A is related to a specific row in Table B. Good examples of keys include:

  • Product ID: To link a sales table with a product details table.
  • Customer Email: To link marketing engagement data with purchase history.
  • Date: To link daily ad spend with daily sales figures.

Before linking in Power BI, make sure of two things:

  1. You have a common column: Both datasets must share a column you can use to link them.
  2. The data types match: If the 'Product ID' is a number in one table, it needs to be a number in the other. If it’s text in one and a number in the other, the relationship will fail. You can easily fix mismatched data types in the Power Query Editor before you create the link.

Method 1: Creating a Relationship in the Model View

This is the most common and efficient way to link your datasets directly within the Power BI desktop. Let's walk through an example of linking a Sales Data table with a Campaign Data table using a common Customer ID column.

Step 1: Load Your Datasets

First, get your data into Power BI. In the Home ribbon, click Get Data and select the appropriate source (e.g., Excel workbook, CSV, SQL Server).

Load your first file (e.g., SalesData.csv). Then repeat the process for your second file (CampaignData.csv). Once loaded, you'll see both tables listed in the Data pane on the right side of your screen.

Step 2: Navigate to the Model View

On the left-hand side of the Power BI window, you'll see three icons for Report, Data, and Model views. Click on the third icon, the Model view. This is where you manage the relationships between your tables. You'll see boxes representing each of your loaded tables.

Step 3: Create the Relationship by Dragging and Dropping

This is the intuitive part. Locate the common column in both tables within the Model view.

Click and hold the Customer ID column in your Sales Data table, drag your cursor across the screen, and drop it directly on top of the Customer ID column in the Campaign Data table.

A line will appear connecting the two tables. That's it! You've created a relationship. Power BI has analyzed the columns and determined the nature of the link - usually a "one-to-many" relationship, which is most common.

(A 'one-to-many' relationship means that for every one unique customer ID in your main customer list, there may be many corresponding entries in your sales data table.)

Step 4: Verify and Edit the Relationship (Optional)

You can double-click the line connecting the tables or go to the Home ribbon and click Manage relationships to see the details. A dialog box will pop up showing:

  • Which tables and columns are connected.
  • Cardinality: This describes the relationship (e.g., Many-to-one, One-to-one). Power BI is usually great at detecting this automatically.
  • Cross filter direction: 'Single' is typically the default and recommended setting. It means filtering one table will also filter the other.

Power BI relies on these relationships to work. Now, when you create a chart or table in the Report view, you can pull 'Campaign Name' from the Campaign Data table and 'Revenue' from the Sales Data table into the same visual, and everything will be aggregated correctly.

Method 2: Merging Queries in Power Query Editor

Sometimes you need to physically flatten your data into a single table. This is where merging comes in. It’s a great option for data shaping or when you need to perform calculations that rely on columns from both tables in the same row.

Step 1: Open the Power Query Editor

In the Power BI Home ribbon, click Transform data. This will open the Power Query Editor, a powerful tool for cleaning, shaping, and combining your data before it even hits your report.

Step 2: Choose the Merge Queries Option

Select the first table you want to serve as your base (e.g., Sales Data). While it's selected, go to the Home ribbon within Power Query and click the dropdown arrow next to Merge Queries. Choose Merge Queries as New to create a new, merged table, leaving your original tables untouched.

Step 3: Configure the Merge Dialog

A new window will appear. It will have your top table already selected. Below it, select the second table you want to merge (e.g., Campaign Data).

Next, click on the common column in both tables to tell Power Query how to match the rows. In our example, click the Customer ID column in the top table and then the Customer ID column in the bottom table. Power Query will tell you how many of the rows match.

Pay attention to the Join Kind dropdown. The default, Left Outer, is often what you need. It keeps all rows from your first table and brings in any matching rows from the second. Other options like Inner will only keep rows that match in both tables.

Step 4: Expand the New Column

After you click OK, you'll be taken back to the Power Query Editor with your new merged table. The last column will have a title like Campaign Data with the word 'Table' in each cell, and a double-arrow icon in the header.

Click this Expand icon. A dropdown will appear with all the columns from your second table. Uncheck the columns you don't need, untick "Use original column name as prefix", and click OK. The columns you selected will now be added to your merged table.

Step 5: Close & Apply

Once you are happy with your new table, click Close & Apply in the top-left corner. Power BI will load this newly created table into your data model, ready for use in your reports.

Common Problems and How to Fix Them

You may run into a few common hurdles when linking datasets. Here are cures for the most frequent headaches:

  • Mismatched Data Types: If one ID column is text and the other is a number, the relationship won't work. To fix this, open the Power Query Editor, select the column, and in the Transform tab, change the Data Type so they both match. Choose "Whole Number" or "Text" for both.
  • Typos and Extra Spaces: A relationship requires an exact match. 'Cust-123 ' (with a space) will not match 'Cust-123'. Use the Trim and Clean functions in Power Query (in the 'Format' dropdown under the 'Transform' tab) to remove leading/trailing spaces and non-printable characters from your key columns.
  • Inactive Relationships: You can only have one active relationship path between two tables at a time. If you try to create a second relationship (e.g., linking by both Customer ID and Date), one will be active (a solid line) and the other will be inactive (a dotted line). This is a more advanced topic, but advanced users can activate specific relationships for a single calculation using the USERELATIONSHIP DAX function.

Final Thoughts

Connecting data sources in Power BI using either relationships or merges unlocks truly meaningful analysis. By bringing your sales, marketing, and operational data together, you move from just knowing what happened to understanding why it happened, allowing you to make smarter, data-informed decisions for your business.

Learning the ins and outs of Power BI is a valuable skill, but sometimes you just need to connect your marketing and sales platforms and get answers quickly. At Graphed, we created a way to skip the manual setup completely. We connect directly to your data sources like Google Analytics, Shopify, Salesforce, and Facebook Ads, so you can build real-time, cross-platform dashboards just by making a request in plain English, without a single drag-and-drop.

Related Articles

How to Connect Facebook to Google Data Studio: The Complete Guide for 2026

Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.

Appsflyer vs Mixpanel​: Complete 2026 Comparison Guide

The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.