How to Make a Comparison Chart in Tableau with AI

Cody Schneider

Comparing your data - whether it's this month's sales versus last month's, or the performance of two different ad campaigns - is the fastest way to find out what’s working. This article will show you how to create clear and effective comparison charts in Tableau, both the traditional way and by using its built-in AI features to speed up the entire process.

Why Bother with Comparison Charts?

In business, context is everything. A single number, like "$50,000 in sales," doesn't tell you much on its own. Is that good? Is it bad? You only know once you compare it to something else:

  • $50,000 this month vs. $30,000 last month? You’re growing.

  • $50,000 in the US vs. $100,000 in Canada? Your Canadian market is stronger.

  • $50,000 on Facebook Ads vs. $25,000 on Google Ads? Facebook is currently your top performer.

Comparison charts turn raw data points into a narrative. They are the backbone of performance analysis, helping you spot trends, identify outliers, and make smarter decisions based on relative performance. Master them, and you’ll spend less time digging through spreadsheets and more time understanding what moves the needle for your business.

Choosing the Right Chart for the Job

Before you jump into Tableau, it’s important to pick the right type of visualization. Choosing the wrong chart can hide your insights or, even worse, mislead your audience. Here are a few great options for comparing data.

Side-by-Side Bar Charts

The classic workhorse for comparison. Use a side-by-side bar chart when you want to compare a specific metric (like sales, website traffic, or leads) across different categories. For example, comparing the quarterly sales figures for two different products. They are easy to read and instantly highlight which category is performing better for a given period.

Line Charts

Line charts should be your go-to when your comparison involves time. Plotting two or more metrics over the same time period - like comparing your website traffic from this year against last year - is perfect for a line chart. This visualization makes it easy to spot trends, seasonality, and moments where one metric overtakes another.

Bullet Graphs

A bullet graph is a fantastic choice for comparing a single measure (like year-to-date revenue) against a target. It packs a lot of context into a small space by also showing performance ranges (e.g., poor, satisfactory, good). Instead of just comparing one number to another, you’re comparing performance against expectations.

Slopegraphs

While a bit more advanced, a slopegraph is powerful for showing a "before and after" story. Imagine you want to show how the market share of several competitors changed from last year to this year. A slopegraph uses lines to connect the rankings or values for each competitor between two points in time, clearly showing who’s rising and who’s falling.

The Traditional Way: Building a Comparison Chart Step-by-Step

For our example, we'll build the most common comparison chart: a side-by-side bar chart to compare sales across different product categories for two separate years. Let’s assume you’re using Tableau's "Sample - Superstore" dataset.

Step 1: Get Your Data Connected

First things first, open Tableau and connect to your data source. If you're following along, select the "Sample - Superstore" dataset that comes with Tableau Desktop.

Step 2: Start with the Basics

Drag the dimension you want to compare, Category, from the Data pane onto the Columns shelf. Then, drag the measure you’re analyzing, Sales, onto the Rows shelf. At this point, you should have a simple bar chart showing total sales for each product category.

Step 3: Add the Comparison Element

Now, let's bring in the element you want to compare across - in this case, the year. Find the Order Date field in your Data pane.

The easiest way to do this is to drag Order Date onto the Color card in the Marks pane. Tableau will automatically break down the sales bars by year, assigning a different color to each. However, you might have bars for 2020, 2021, 2022, and 2023. This is great, but what if we only want to compare the last two full years?

Step 4: Filter Your Data

To focus your analysis, you need to filter the data. Drag the Order Date field onto the Filters card. A dialog box will appear.

  • Choose "Years" and click Next.

  • Select the years you want to compare, for instance, 2022 and 2023.

  • Click OK.

Your chart now shows the sales for your chosen categories, but it displays stacked bars for 2022 and 2023 rather than placing them side-by-side. Let’s fix that.

Step 5: Arrange for Side-by-Side Comparison

Finally, find the YEAR(Order Date) pill that's on your Color card. Drag this pill and drop it onto the Columns shelf, placing it right next to the Category pill.

Voila! You now have a classic side-by-side bar chart. It’s clean, easy to read, and effectively compares sales performance across categories for 2022 versus 2023. Don’t forget to give your sheet a clear title like "2022 vs. 2023 Sales by Category."

The Faster Way: Using Tableau’s AI Features

Building charts by dragging and dropping is core to Tableau, but learning where everything goes takes time and practice. This is where Tableau's AI-powered features, particularly Ask Data, come into play. They dramatically lower the learning curve and let you create visualizations by simply typing what you want in plain English.

Think of it as having a conversation with your data. You don't need to know whether "Category" is a Dimension or "Sales" is a Measure. You just ask your question, and Tableau figures out the rest.

How to Use Ask Data for Comparison

If your version of Tableau supports it, you'll see a section for Ask Data when you publish a data source to Tableau Server or Cloud. To get started:

1. Open your Data Source in Ask Data

Navigate to your published data source and open the Ask Data interface. It looks like a simple search bar.

2. Type Your Question in Plain English

Instead of doing all the steps from the previous section, just type your request into the search bar. Try typing this:

compare sum of sales by category for 2022 and 2023

As you type, Tableau's AI will parse your language, suggesting relevant fields from your data source and trying to understand your intent.

3. Watch Tableau Build the Chart

Once you hit Enter, Ask Data will automatically generate a visualization. In this case, it will likely create the same side-by-side bar chart we painstakingly built manually. It understands "compare," "sales," "by category," and the date period you specified. It's the same result in a fraction of the time.

4. Refine and Customize

The chart it creates is fully interactive. You can easily switch the visualization type on the right-hand panel (maybe you'd prefer a line chart?). You can also continue the "conversation" to drill down further. Try asking a follow-up question like:

now just for the west region

Tableau will add a filter, updating the chart instantly without you having to find the "Region" field and drag it to the filter shelf. This conversational approach saves countless clicks, especially when you're exploring data without a clear endpoint in mind. You can uncover insights much faster because the barrier between question and answer has been removed.

This AI-first approach is incredibly empowering for team members who aren't data analysts. They can get answers to their own questions without needing to understand the technical nitty-gritty of building charts from scratch.

Final Thoughts

Building effective comparison charts in Tableau is an essential skill, allowing you to quickly spot trends and analyze performance. Whether you prefer the control of manually building charts or the speed of AI-powered tools like Ask Data, Tableau provides powerful options to turn your data into valuable insights.

Tools like Tableau's Ask Data show just how powerful natural language can be. At Graphed, we decided to build our entire platform around this idea. We let you connect marketing and sales sources like Google Analytics, Shopify, and Salesforce, and then create entire real-time dashboards just by describing what you want to see. Instead of being one feature, AI-powered analysis is the entire experience, saving you from the hours typically spent pulling reports, wrestling with spreadsheets, and configuring dashboards manually.