How to Create a Correlation Matrix in Tableau

Cody Schneider9 min read

Seeing how different metrics in your data relate to each other is the key to unlocking smarter business decisions. When one number goes up, does another go down? Or do they move together? A correlation matrix is a perfect visual tool for answering just that, showing you the strength and direction of relationships between all your variables in one clear grid. This guide will walk you through exactly how to build one in Tableau.

GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

We’ll cover what a correlation matrix is, how to prepare your data using a self-join, and a step-by-step process for creating and formatting the visualization. Whether you’re trying to connect marketing spend to sales or operational costs to a drop in profit, you’ll have a clear view of what’s connected in your data by the end of this tutorial.

What Is a Correlation Matrix and Why Is It Useful?

Before we jump into building, let's quickly cover what we're making and why it matters. A correlation matrix is essentially a table that displays the correlation coefficients between an array of variables. Each cell at the intersection of two variables shows their correlation coefficient.

This coefficient is just a number between -1 and +1 that represents their relationship:

  • +1 (Perfect Positive Correlation): When one variable increases, the other variable increases by a perfectly consistent amount. For example, the total cost of apples and the number of apples you buy.
  • 0 (No Correlation): The two variables have no relationship at all. Their movements are completely random relative to each other. For example, the price of coffee in Brazil and the number of rainy days in Seattle.
  • -1 (Perfect Negative Correlation): When one variable increases, the other decreases by a perfectly consistent amount. For example, the miles you've driven in your car and the amount of gas left in the tank.

In the real world, you’ll rarely see perfect correlations of +1 or -1. Most relationships fall somewhere in between, like a 0.7 (strong positive relationship) or a -0.4 (moderate negative relationship).

So, why is this useful for your business?

  • Identify Key Drivers: Spot which marketing activities are most strongly correlated with new sign-ups or sales.
  • Improve Forecasting: If you know two metrics are tightly linked (e.g., website traffic and leads), you can create more accurate forecasts for lead generation based on traffic projections.
  • Find Unexpected Connections: You might discover relationships you didn't know existed, leading to new strategies or efficiencies. For instance, is there a correlation between shipping delays and customer churn?

Now that we understand the goal, let’s get our data ready.

GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

Preparing Your Data: The Self-Join

The trickiest part of building a correlation matrix in Tableau is structuring the data correctly. To compare multiple measures against each other (like Sales vs. Profit, Sales vs. Quantity, etc.), we need a way to plot them on both an X and Y axis in the same view. The standard Tableau "drag-and-drop a measure" approach won't work here.

The solution is to perform a self-join. This means you join a table to itself. This essentially creates a copy of your data, allowing you to use one set of measures for the columns and the other set for the rows in your matrix.

Here’s how to set it up. For this example, we’ll use Tableau's sample "Superstore" dataset.

  1. Navigate to the Data Source tab in your Tableau workbook.
  2. Drag your data source (in this case, the "Orders" sheet) onto the canvas.
  3. Now, drag the exact same "Orders" sheet onto the canvas again, to the right of the first one.
  4. Tableau will ask you to define the join clause, which connects the two tables. This is critical. You need to join them based on a field that defines the row level correctly for what you want to correlate. If you are correlating aspects of each order, joining on "Order ID" makes sense.
  5. In the "Join condition" dialog, select the same unique identifier for both tables. Let’s use Order ID = Order ID (Orders1).

Your join setup should look something like this. You've now "doubled" your data in a way that lets you compare any measure from the original Orders table with any measure from the copied Orders1 table.

Step-by-Step: Creating the Correlation Matrix in Tableau

With the self-join complete, we're ready to build the visualization itself. Follow these steps carefully.

1. Set Up the Grid with Measure Names

The foundation of our matrix is a grid made from the special Measure Names fields that Tableau automatically generates.

  • Go to your worksheet. In the Data pane on the left, you will now see your fields organized under two tables: "Orders" and "Orders1".
  • From the "Orders" table, find the Measure Names field and drag it to the Columns shelf.
  • From the "Orders1" table, find its Measure Names field and drag it to the Rows shelf.

You’ll immediately see a grid start to form. It will likely include every single measure from your data source, so the next step is to choose which ones we want to correlate.

GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

2. Filter for Your Desired Measures

We don't need to correlate every numerical field, especially things like IDs or postal codes. We only want our key business metrics.

  • You should see two "Measure Names" pills on the Filters card - one for columns and one for rows.
  • Right-click the first Measure Names filter and select "Edit Filter...".
  • Uncheck "All" and select only the meaningful measures you want to analyze. For our Superstore example, let's choose: Sales, Profit, Discount, and Quantity. Click OK.
  • Now, right-click the second Measure Names filter (the one for Orders_1) and do the same thing. Ensure the exact same measures are selected.

Your grid should now be a manageable 4x4 matrix with the labels for Sales, Profit, Discount, and Quantity on both the rows and columns.

3. Create the Correlation Calculation

This is where the magic happens. We need to write a calculated field that computes the correlation between the measures from our two joined tables.

  • Go to Analysis > Create Calculated Field.
  • Name the field something like "Correlation".
  • Here's the key: because we’ve joined the table on a row-by-row basis (Order ID), we are working with values that aren't pre-aggregated. A robust method for this setup uses a window function. Enter the following formula:

WINDOW_CORR(SUM([Measure Values]), SUM([Orders1].[Measure Values]))

What does this formula mean?

  • SUM([Measure Values]): Measure Values is another special Tableau field that holds the values of the measures you've selected in your Measure Names filter. This part grabs the value from the "Orders" table for each cell.
  • SUM([Orders1].[Measure Values]): This does the same thing, but for our joined "Orders1" table.
  • WINDOW_CORR(...): This is a table calculation that computes the correlation between the two sets of values across the entire data window (our view).

Click OK to save the calculation.

4. Assemble the Visualization

The last step is to add our calculation to the view to bring the matrix to life.

  • Find your "Correlation" calculated field in the data pane and drag it onto the Color mark on the Marks Card.
  • (Optional but recommended) While the "Correlation" field is still selected, also drag it onto the Label mark. This will display the correlation coefficient in each cell.
  • Change the mark type on the Marks Card from "Automatic" (which is likely text) to "Square". This will create a classic heatmap look where each cell is fully colored.

You now have a functional correlation matrix! You can right away see that "Profit" and "Sales" have a positive correlation, while "Discount" and "Profit" have a strong negative correlation.

Making Your Correlation Matrix Pop

A functional matrix is great, but a well-formatted one is even better. Here are a few tips to make your visual easier to interpret at a glance.

1. Use a Diverging Color Palette

For correlation, where you have positive and negative values, a diverging color palette is a must. It uses a neutral color for the center (zero) and two different colors for positive and negative values.

  • Click on the Color mark on the Marks Card and select "Edit Colors...".
  • From the palette dropdown, choose a diverging palette like "Red-Blue Diverging" or "Orange-Blue Diverging". Red is often used for negative correlation and blue or green for positive.
  • Check the "Use Full Color Range" box to make sure -1 and +1 get the most saturated colors. You can also click "Advanced" and set the center to 0 to ensure your neutral color aligns perfectly with no correlation.
GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

2. Displaying with Shapes

Instead of a grid of squares, you can use circles where both size and color convey information. This is great for emphasizing the strongest correlations (both positive and negative).

  • Change the Mark Type to "Circle".
  • Leave your "Correlation" calculation on the Color mark.
  • Create another simple calculated field called "Abs Correlation" with the formula:

ABS([Correlation])

  • Drag this new "Abs Correlation" field to the Size mark. Now, the circles with the strongest relationships (closest to -1 or +1) will be the largest, drawing the eye instantly.

3. Clean Up Labels and Tooltips

Your labels are likely cramped. Format them to have fewer decimal places. Right-click your "Correlation" pill on the Label mark, select "Format...", navigate to "Numbers", and choose "Number (Custom)" to set it to two decimal places.

Also, edit the tooltip to make it more descriptive. Click the "Tooltip" mark and edit the text to something more user-friendly, like:

*"The correlation between &lt,Measure Names (Orders1)&gt,, and &lt,Measure Names&gt, is &lt,AGG(Correlation)&gt,."*

Final Thoughts

Creating a correlation matrix in Tableau requires a few extra setup steps, particularly the self-join, but once it’s done you can quickly see the powerful relationships hidden in your data. By combining a calculated field using WINDOW_CORR with some mindful formatting, you move from a confusing spreadsheet to an immediate, actionable snapshot of your business drivers.

While mastering techniques like these is a fantastic skill, sometimes you just need to find these relationships without all the setup and calculations. At Graphed, we've focused on removing these technical barriers completely. Instead of building self-joins, you can connect your marketing and sales data and just ask a question like, "Compare my Facebook ad spend vs. Shopify conversions last quarter." Our platform creates the charts and dashboards for you in real time, letting you explore these connections conversationally, no calculated fields required.

Related Articles