What is Table Calculation in Tableau?

Cody Schneider7 min read

If you've ever built a chart in Tableau, you’ve probably reached a point where you think: "Okay, I see my monthly sales, but what I really want is a running total of sales over time." Or maybe you've built a bar chart of sales by product category and wondered, "What percentage of my total sales does each category represent?" Answering these questions doesn't require complex calculations or custom fields. It requires table calculations, one of Tableau's most powerful and immediate features for deeper analysis. This tutorial will walk you through what table calculations are, how they work, and how you can use them to add another layer of insight to your visualizations.

GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

What is a Table Calculation, Really?

Think of a table calculation as a special type of calculation that computes on the local data in your worksheet. It operates on what Tableau can currently "see" in your view. Normal calculations, like SUM([Sales]), are computed in the database, and the aggregated result is sent back to Tableau. Table calculations are different, they are a secondary pass performed only on the numbers already visible in your aggregated table.

The name "table calculation" is a hint. It relies on the structure of the virtual table created by the dimensions on your Rows, Columns, and Marks card. Change the structure - by adding, removing, or rearranging pills - and the result of your table calculation will change, too. This makes them incredibly flexible but also a bit tricky until you understand the core concepts.

GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

The Key Concept: "Compute Using"

The single most important part of using table calculations is understanding the "Compute Using" setting. This option is the instruction you give Tableau. It tells it which part of your view's table to use and in what direction to calculate the result. You find it by right-clicking a measure that has a table calculation applied and selecting "Edit Table Calculation."

Let's say you have a view showing sales broken down by Year and Region. You have a few choices for "Compute Using":

  • Table (Across): The calculation moves horizontally across the table, restarting for each new row. For our example, it would compute across the years for the first region, then restart and do it again for the second region, and so on.
  • Table (Down): The calculation moves vertically down the table, restarting for each new column. It would compute down through the regions for the first year, then restart and do it again for the second year.
  • Table (Across then Down): Moves across all years for the first region, then moves to the next row (the next region) and continues where it left off.
  • Pane: The "Pane" options work just like the "Table" options but are restricted to individual panes in your view. A pane is created by a discrete dimension field. For instance, if you had Quarter and Year on your columns shelf, each Year would form a pane. A Pane (Across) calculation would restart for each new Year.
  • Specific Dimensions: This is where you get the most control. Instead of picking a direction, you tell Tableau exactly which dimensions to use for the calculation, and in what order. This is helpful for more complex views where "Table (Across)" might not be precise enough.

Understanding "Compute Using" is the hump you have to get over. Once it clicks, you'll be able to create powerful insights with just a few clicks.

Common Table Calculations in Action (With Step-by-Step Examples)

The best way to learn is by doing. The easiest way to get started is with "Quick Table Calculations," which are pre-built calculations for common use cases. Let's walk through a few.

Example 1: Calculating a Running Total of Sales

Running totals are perfect for showing cumulative growth over time. You can see how sales accumulate month-over-month throughout the year.

  1. Drag Order Date to the Columns shelf. Right-click it and make sure it's set to a discrete MONTH (the one with the blue icon).
  2. Drag Sales to the Rows shelf. You'll see a basic line chart of sales per month.
  3. Right-click the SUM(Sales) pill on the Rows shelf.
  4. Hover over Quick Table Calculation and select Running Total.

That's it! Your line chart will instantly transform from showing fluctuating monthly sales into a smooth, upward-sloping curve representing the cumulative total as the year progresses.

GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

Example 2: Finding the Percent of Total Sales by Region

This is one of the most common business questions. You have sales broken down by some category (region, product, campaign), and you want to see how much each part contributes to the whole.

  1. Drag Region to the Columns shelf.
  2. Drag Sales to the Rows shelf to create a simple bar chart.
  3. Right-click the SUM(Sales) pill on the Rows shelf.
  4. Hover over Quick Table Calculation and select Percent of Total.

The Y-axis and labels on your bar chart immediately switch from dollar amounts to percentages. You can now easily see, for example, that the "West" region accounts for 35% of all sales. For this calculation, Tableau is summing up the sales from all visible bars and then dividing each individual bar's value by that total sum.

Example 3: Analyzing Year-Over-Year Sales Growth

Tracking growth is fundamental for any business. Table calculations make it easy to compare period-over-period performance without writing a single line of fancy code.

  1. Drag Order Date to the Columns shelf and set its level to a discrete YEAR.
  2. Drag Sales onto the Rows shelf.
  3. Right-click the SUM(Sales) pill, navigate to Quick Table Calculation, and then select Year over Year Growth.
  4. Optional: Drag another instance of Sales to the Rows shelf so you can see both the raw sales numbers and the growth percentage in one view. You could also change the chart type to a Bar chart to make the growth more visually striking.

You'll notice the first year in your view doesn't have a growth value. That's perfectly normal - there's no prior year in the view to compare it against! This shows the intelligence baked into table calculations.

GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

Going Custom: Writing Your Own Table Calculation Functions

Sometimes the "quick" options aren't enough. Tableau has a whole family of functions made specifically for table calculations, allowing you to build exactly what you need.

You access this by creating a new Calculated Field. When you start typing functions like LOOKUP(), WINDOW_SUM(), INDEX(), or RANK(), you’re using table calculation functions.

Here are a few popular ones:

  • LOOKUP(expression, offset): This is incredibly useful. It lets you "look up" the value of the expression in a different row. For example, SUM([Sales]) - LOOKUP(SUM([Sales]), -1) calculates the difference in sales from the previous period (because -1 looks one row back).
  • WINDOW_SUM(expression, [start, end]): This function sums the expression over a "window" of data. WINDOW_SUM(SUM([Sales])) returns the total sales across the entire partition - the same thing Percent of Total uses behind the scenes.
  • RANK(expression): Ranks the current row within the partition. You could use this to create a "Top 10 Products by Sales" visualization.
  • INDEX(): Simply returns the index (row number) of the current row in the partition, starting from 1. You can use this for powerful custom filtering, like creating a filter for INDEX() <= 5 to only show the top 5 results.

For example, to calculate the sales for the previous month, you could create a calculated field with this formula:

LOOKUP(SUM([Sales]), -1)

When you drag this field into your view, you have to remember to set its "Compute Using" direction, just like any other table calculation, to ensure it looks for the previous month correctly.

Final Thoughts

Table calculations are an essential part of mastering Tableau because they let you perform powerful analytics with incredible speed. Once you get comfortable telling Tableau how to "Compute Using" the data in your view, you unlock a new level of analysis - allowing you to compare values, calculate growth, and find running totals without touching a line of code.

Then again, we know there's a huge learning curve for tools like Tableau. Many people spend hours watching tutorials just to figure out the right combination of "Compute Using" settings to answer what feels like a simple business question. That's why we created Graphed. We believe you should get answers by asking questions, not by learning a complex piece of software. Instead of wrangling pills and menus, you can just ask, "Show me a trend of our running total of sales this year," and get an interactive dashboard, built in seconds with your live data.

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!