Multiple Calculations on Multiple Measures in One Tableau Table

Suppose you want multiple measures in your view. No problem.

But suppose you want multiple calculations on those multiple measures, and you want the multiple calculations to all be in the same row. That’s what this post was discussing. The person wanted a view with a different measure in each row and a different calculation in each column. The view should look something like this:

Tableau view with a different measure in each row and a different calculation in each column

Easy in Excel, but not so easy in Tableau! You can easily have multiple rows with multiple measures, but how to have this while also doing different calculations in each column? The only way I can see to do it is to first reshape your data. Your data probably looks like this:

Source data with one column per measure before reshaping

But instead it should look like this, so that each metric gets its own row.

Reshaped data with one row per metric

Once you have it reshaped, you create a couple calculations in Tableau:

Calculated field for the current month value
Calculated field for month-over-month change

And then create a view like this:

Tableau view with metrics in rows and sum, average and max columns

Here’s the data I used for this example.

Here’s the final workbook.

Method 1: Measure Names / Measure Values (no reshaping)

For 2–4 measures: drag each measure in several times, change each copy’s aggregation (SUM, AVG…), and put Measure Names on Rows and Measure Values on Text. The limitation is that each column header is a measure name, so you can’t get one calculation per column.

Method 2: pivot the data (the original approach, written out)

  1. In the data source, select the measure columns → right-click → Pivot. You get Pivot Field Names (rename it to Metric) and Pivot Field Values (rename it to Value).
  2. Create one calculation per column:
    // Total
    SUM([Value])
    // Average
    AVG([Value])
    // Max
    MAX([Value])
  3. Put Metric on Rows, then Measure Names on Columns and Measure Values on Text, filtering Measure Names to Total, Average and Max.

Result: one row per metric, one column per calculation, like the Excel layout. Want more practice reshaping data? Try these pivot practice questions.

When you can’t pivot (published data source)

Use one calculated field per cell, e.g. SUM([Sales]), AVG([Sales]), SUM([Profit])… and lay them out as Measure Names on Columns. Or pivot in Tableau Prep with a Pivot step (columns to rows). If your measures live in separate tables, see combining tables in Tableau; for another calculation walkthrough, find the median in Tableau.

FAQ

How do I show multiple measures in rows in Tableau?

Put Measure Names on Rows and Measure Values on Text (or Columns).

Can each column use a different aggregation?

Yes, with the pivot method above, or by adding separate calculated fields.

Sources: Pivot data · Measure Names and Measure Values.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top