How to Create a Relationship Between Two Data Sources in Tableau
Trying to analyze marketing performance in one tab and sales data in another feels like you're only seeing half the story. To get real insights, you need to bring those datasets together. This guide will walk you through exactly how to create a relationship between two different data sources in Tableau, allowing you to build comprehensive dashboards that show the full picture of your business performance.
Why Connect Different Data Sources at All?
Connecting data sources allows you to move beyond siloed reports and see the cause-and-effect relationships within your business. Imagine your company's data lives in different "neighborhoods." Your website traffic data from Google Analytics is in one, your sales numbers from Shopify or Salesforce are in another, and your ad spend from Facebook Ads is in a third. By themselves, they offer limited views:
- Google Analytics can tell you how many people visited from a campaign.
- Salesforce can tell you how much revenue you generated.
- Facebook Ads can tell you how much you spent.
But the real million-dollar questions lie in the connections between them:
- Which specific Facebook ad campaigns are driving the most high-value sales?
- What is the true return on ad spend (ROAS) when you link campaign costs to actual revenue?
- Do visitors from organic search convert to customers at a higher rate than those from paid ads?
Creating a relationship between these sources in Tableau is how you answer these questions. It lets you build a single dashboard that combines metrics from multiple platforms, providing a unified view of performance that informs smarter, more profitable decisions.
Tableau Relationships vs. Joins: What's the Difference?
Before you start connecting your data, it’s important to understand Tableau's two main methods for combining data: relationships and joins. While they sound similar, they work very differently, and Tableau strongly recommends using relationships for most situations.
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
The "Old" Way: Joins
Traditionally, you would use a join to combine data. A join merges tables together based on a common field and creates a single, new, flattened table of data before you start your analysis. You pick your join type up front (inner, left, right, full outer), and Tableau mashes everything together.
The problem? Joins can be rigid and sometimes problematic. They can lead to data duplication if the levels of detail don't match up. For instance, if you join a Customers table to an Orders table, the customer information (name, email, city) will be duplicated for every single order they’ve ever placed. This can inflate your numbers and lead to inaccurate calculations if you aren't careful.
The "New," Smarter Way: Relationships
Relationships are Tableau’s more flexible and modern approach. Instead of creating one big, permanent table, relationships keep your data sources separate but tell Tableau how they are related to each other. Think of it as introducing two friends — you're not merging them into one person, you're just establishing their connection.
This "connection" between tables is often visualized as a flexible line or a "noodle." When you build a visualization, Tableau intelligently looks at the fields you're using from each table and decides on the best way to query the data in real-time. This smart, on-the-fly approach prevents the data duplication issues common with joins and generally results in better performance, especially with large datasets.
For most analyses, relationships are the recommended method. They maintain the original level of detail for each data source and give you more accurate, flexible results with less upfront configuration.
Before You Begin: Prep Your Data Sources
A successful relationship depends on good data hygiene. Before you jump into Tableau, take a moment to look at your data sources and ensure they're ready to be connected. The most important requirement is a common field.
A common field, also known as a key, is a column of data that exists in both of your data sets and contains matching values. This is how Tableau knows which row in the first data source corresponds to which row in the second.
Examples of common fields include:
- CustomerID: Linking customer information to their order history.
- Email Address: Tying contacts in HubSpot to transaction data in Stripe.
- Campaign Name: Connecting ad spend data from Google Ads to lead data in a CRM.
- Date: Relating weekly sales figures to weekly marketing expenses.
Make sure this key field is clean and consistent across both sources. Check for:
- Consistent Naming: "United States" in one sheet and "USA" in another won't match.
- Matching Data Types: A
CustomerIDsaved as a number (e.g.,12345) in one file and as text (e.g.,CUST-12345) in another won't connect properly. - Leading/Trailing Spaces: A simple space at the end of an entry (e.g., "Campaign A ") will prevent it from matching with "Campaign A".
Taking a few minutes to clean up your common field will save you hours of troubleshooting later.
Step-by-Step Guide: How to Create a Relationship in Tableau
Ready to connect your data? Let’s use a simple example: relating a list of customer details from one file to a list of orders in another. Our common field will be Customer ID.
Step 1: Connect to Your First Data Source
First, we need to bring our primary data source into Tableau.
- Open Tableau Desktop. On the start page, under the Connect pane, choose the file type or server that hosts your first data source. For this example, we'll click on Microsoft Excel.
- Navigate to your first file (e.g.,
Customers.xlsx) and click Open. - Tableau will take you to the Data Source screen. You'll see the tables (or sheets) from your Excel file listed on the left.
Step 2: Add Your Second Data Source
Now, while still on the Data Source screen, let's add the second file.
- In the Connections area at the top left, click the Add button (it looks like a cylinder with a plus sign).
- Again, select the type of file or server for your second data source (e.g., Microsoft Excel).
- Find and open your second file (e.g.,
Orders.xlsx).
You'll now see both of your data connections listed in the top-left pane. Each file's tables will be grouped under its connection name.
Step 3: Establish the Relationship
This is where the magic happens. We'll now tell Tableau how these two sources are related using the "noodle."
- From your first data source (
Customers.xlsx), drag the sheet you want to use (e.g.,Customer Info) onto the canvas area that says "Drag tables Here". This becomes your primary table. - Now, from your second data source (
Orders.xlsx), drag its corresponding table (e.g.,Order Details) onto the canvas. As you drag it near the first table, a flexible line — the "noodle" — will appear, connecting them.
Tableau will often automatically detect the relationship if the common field has the same name in both tables (e.g., Customer ID). If it does this successfully, you're almost done!
Free PDF · the crash course
AI Agents for Marketing Crash Course
Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.
Step 4: Configure the Relationship Details
If Tableau didn't guess the common fields correctly, or if you want to inspect the settings, you can easily configure the relationship yourself.
- Click on the noodle connecting the two tables. This will open the Edit Relationship dialog box.
- At the top, you'll see your two tables listed. Underneath, Tableau displays the fields it's using to form the relationship.
- If the fields are incorrect, click the dropdown menu for each field and select the correct common field from each table (e.g., select
Customer IDfromCustomer InfoandCustomer IDfromOrder Details). - You can also click Add more fields if your relationship relies on more than one column (e.g.,
DateandRegion). - You'll notice options for Performance Options (Cardinality and Referential Integrity). For now, it's best to leave these on the default settings unless you have a deep understanding of your data structure. Click the "X" to close the dialog box.
Step 5: Build Your Visualization!
With the relationship established, you're ready to analyze your combined data.
- Click on a new worksheet tab at the bottom of the screen (e.g., Sheet 1).
- Look at the Data pane on the left side. You'll see that your fields are neatly organized under their original table names (
Customer InfoandOrder Details). - Now, you can use fields from both tables in the same visualization! For example, drag
Customer Segmentfrom theCustomer Infotable to the Rows shelf, and then dragSalesfrom theOrder Detailstable to the Columns shelf.
Just like that, you've created a bar chart showing total sales broken down by customer segment — a visualization that would have been impossible without connecting your two data sources.
Tips for Working with Relationships
As you get more comfortable, keep these best practices in mind to keep your analysis clean and efficient.
- Check for Unexpected Blanks: If your chart is showing a large number of null or blank values after creating a relationship, it often means the common key isn't matching up correctly. Re-check the fields for data type mismatches or inconsistent values.
- Think About Data Granularity: A relationship works best when you relate a more "dimensional" table (like customer details) to a more "transactional" table (like order records). For every one customer, there can be many orders, creating a classic one-to-many relationship.
- Create a Common Key if One Doesn't Exist: What if there's no single column in common? You can often create one using a calculated field in Tableau. For instance, if one table has
First NameandLast Nameand another hasFull Name, you can create a calculated field in the first table like this:[First Name] + " " + [Last Name]to serve as your key.
Final Thoughts
Connecting data sources with relationships in Tableau unlocks a deeper level of analysis, allowing you to move from asking "what happened?" to "why did it happen?". By combining different datasets — like ad spend and sales revenue — you gain a holistic view that empowers you to make smarter, data-driven decisions for your business.
While this process is incredibly powerful, setting up data sources, cleaning key fields, and building dashboards in traditional BI tools requires time and learning. We created Graphed to simplify this entire workflow. Just connect your data platforms like Google Analytics, Shopify, and Facebook Ads with a few clicks, and our AI data analyst builds real-time dashboards for you based on simple, natural language prompts. You can just ask, "Show me a dashboard of ROAS by campaign for last month," and get an interactive dashboard instantly — no noodles required.
Related Articles
How to Create Facebook Ads API for Claude Code
Create a Meta Marketing API access token that never expires, using a system user, so Claude Code can pull Facebook ad reports and manage campaigns.
ClickHouse vs Postgres: When to Switch to Columnar
Comparing ClickHouse vs PostgreSQL means matching storage architecture to workload. Row storage wins for transactions. Columnar wins for scan-heavy analytics.
Google Ads for Orthodontists: Get More Booked Consults
Most orthodontic Google Ads campaigns waste money on low-intent searches. The problem is structure, not the platform.