How to Merge Two Data Sources in Tableau
Trying to show the full picture of your business performance often feels like assembling a puzzle with pieces from a dozen different boxes. You have your customer data in Salesforce, your website traffic in Google Analytics, and your campaign budgets in a Google Sheet. To see how one impacts the other, you first have to bring them together. This article will show you exactly how to do that by merging data sources in Tableau using its two primary methods: data joining and data blending.
Data Joining vs. Data Blending: What's the Difference?
Before jumping into the step-by-step instructions, it's important to understand the two main options Tableau gives you for merging data. They sound similar, but they work in fundamentally different ways and are suited for different situations.
- Data Joining: Think of this as combining tables at the row level before any analysis happens. You're effectively creating a single, new, wider table in the background that contains columns from all your original tables. Joins require a common field (like "Customer ID" or "Order Date") to link the rows together. This is the best method when your data lives in the same source, such as two different sheets in the same Excel workbook or multiple tables within the same SQL database.
- Data Blending: This method works at an aggregated level. Instead of combining every single row, Tableau queries each data source independently, aggregates the results in a view, and then displays those aggregated results together. You can think of it as displaying two separate visuals on top of each other and linking them with a common dimension. Blending is your go-to option when your data comes from completely different sources that can't be joined at the database level, like connecting data from Google Analytics to your company's internal SQL database.
In short: use joins for combining data from a single source at a granular level, and use blending for combining aggregated data from multiple, different sources.
Method 1: Performing a Data Join in Tableau
Data joining creates a powerful foundation for your analysis when you need to combine related information into one unified view. Let's walk through exactly how to do it.
When to Use Joining
Use a join when:
- You have multiple tables in a single SQL database (e.g., an "Orders" table and a "Customers" table).
- You're combining data from different sheets in a single Excel or Google Sheets file.
- Your data sources have a clearly defined common field to link on, and you need to analyze the combined data at the row level.
Step-by-Step Guide to Creating a Join
- Connect to Your Data: In Tableau Desktop, connect to your data source as you normally would (e.g., Microsoft Excel, PostgreSQL, etc.). For this example, let's assume we're connecting to an Excel file with two sheets: 'Orders' and 'Returns'.
- Drag Your First Table to the Canvas: From the left-hand pane on the 'Data Source' tab, drag your primary table ('Orders') onto the canvas area that says "Drag tables here."
- Add Your Second Table: Now, drag your second table ('Returns') onto the canvas and drop it near the first table. Tableau will automatically try to create a join between them, and you'll see a Venn diagram icon appear, which represents the join.
- Configure the Join Clause: Click on the Venn diagram icon to open the join configuration options. This is where you tell Tableau how to connect the tables.
Understanding the Four Types of Joins
Choosing the correct join type is crucial for ensuring your final dataset is accurate. Here's a quick breakdown:
Inner Join
This is the most restrictive join type. It keeps a record only if the join key (like Order ID) exists in both tables. Use this when you only want to analyze data that has a complete match across your sources. For example, using an inner join on Order ID would give you only the orders that were also returned.
Left Join
A left join keeps all the records from your left table (the table you first dragged onto the canvas) and only the matching records from the right table. If a record in the left table doesn't have a match in the right table, its corresponding columns from the right table will be filled with null values. This is incredibly useful when you want to see all your primary data enriched with secondary data where available. For instance, a left join on 'Orders' and 'Returns' would show all orders, and for those that were returned, it would also show the return details.
Right Join
This is the exact opposite of a left join. A right join keeps all records from your right table and only the matching records from the left. This is less commonly used but is helpful if the second table you bring in is your primary focus. Using our example, this would show you every return and its corresponding original order details.
Full Outer Join
A full outer join keeps all records from both tables. If a record in either table doesn't have a match in the other, null values will be used to fill in the gaps. This gives you the most comprehensive view of your entire dataset, but it can also result in a very large table with many nulls.
Method 2: Performing a Data Blend in Tableau
Data blending is your secret weapon for quickly gaining insights from disparate data sources without having to build a complex data warehouse. It's perfect for answering questions that require data from different systems.
When to Use Blending
Use a data blend when:
- Your data is located in two completely different data sources (e.g., HubSpot and Shopify).
- One of your tables is much larger or more detailed than the other (e.g., analyzing daily website sessions against monthly budget goals).
- You only need high-level insights and don't require row-level analysis across the combined data.
Step-by-Step Guide to Blending Data
The process for blending is quite different as it happens inside your worksheet, not on the 'Data Source' tab.
- Connect to Your Primary Data Source: First, select and connect to your primary source of data (for example, Salesforce). Navigate to a worksheet.
- Create an Initial View: Drag one or more dimensions from your primary data source into the view. For instance, you could drag
Close Dateonto the Columns shelf. This initial view is critical because any field used here becomes a potential linking field. - Connect to Your Secondary Data Source: Go to Data > New Data Source and connect to your second source (e.g., a Google Sheet containing marketing spend data). Notice how the 'Data' pane now lists both data sources.
- Activate the Linking Field: Tableau will automatically look for fields with the same name in both data sources to use as a blend relationship. In our example, both Salesforce and the Google Sheet might contain a
Datefield. You'll see a small grey broken link icon next to this common field. Click it, and it will turn into a solid orange link icon, signifying that the link is now active. This is the field that will connect your two datasets. The data source with the blue checkmark is the primary source, the one with the orange checkmark is secondary. - Bring in Data from the Secondary Source: Switch back to your secondary data source (the Google Sheet in our example). Drag a measure, like
Ad Spend, onto the Rows shelf in your view. Voilà! You should now see both Salesforce data visualized alongside your Google Sheets data in the same chart.
A Practical Example: Combining Shopify Sales with Facebook Ads Data
Let's put this into a real-world context. Imagine you're an e-commerce manager who wants to see if there's a correlation between daily Facebook Ads spend and daily sales revenue from Shopify.
- Your primary data source would be Shopify. You connect to it and start a view by dragging the
Order Datedimension to the Columns shelf andTotal Salesto the Rows shelf. You now have a line chart showing daily sales. - Your secondary data source would be Facebook Ads (which you've connected to).
- In the Data pane, you'd make sure the
Datefield in the Facebook Ads data source has an orange link icon next to it, confirming it's linked to theOrder Datefrom Shopify. - Finally, you'd drag the
Amount Spentmeasure from the Facebook Ads source and drop it onto your Rows shelf. Tableau automatically creates a second line chart in the same view, allowing you to visually compare your ad spend and revenue on a daily basis.
This is a perfect example of blending: the datasets are from completely different platforms, and you're combining them at an aggregated - in this case, daily - level.
Final Thoughts
Learning how to effectively bring your data together is a fundamental step in going from basic charts to powerful, revealing analyses. Whether you're using joins to create a unified table or blends to layer insights from disparate systems, mastering these Tableau features will allow you to see the complete story your data is trying to tell.
While tools like Tableau offer deep control for expert analysts, we know that getting all your data connected and set up can be a major hurdle, especially for busy marketing and sales teams. That's why we built Graphed to handle the heavy lifting of connecting your sources for you. We simplify the entire process by allowing you to connect platforms like Shopify, Google Analytics, Salesforce, and Facebook Ads with a few clicks and then build reports in real-time just by asking questions - no joins or blends or data literacy courses required.
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!
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.