Tableau Funtion: TOTAL()

Tableau Function: TOTAL( )

Category: Table Calculation Functions

What Is the Function?

Purpose of the Function

The TOTAL() function in Tableau is a table calculation that computes the total of a measure across the entire partition, ignoring the level of detail of individual rows. It allows you to reference grand totals or subtotals directly inside calculated fields.

In simple terms, TOTAL() answers:
“What is the total value for this entire group or partition?”

Type of Calculations It Performs

  • Table calculations

  • Partition-level aggregations

  • Context-aware totals

  • Post-aggregation analytics

TOTAL() is evaluated after aggregation and respects the table calculation scope and partitioning defined in the view.

Practical Use Cases

  • Calculating percent of total

  • Comparing individual values to overall totals

  • Creating contribution or share metrics

  • Building ratio-based KPIs

  • Normalizing values within a partition


TOTAL(expression)

ParameterTypeDescription
expressionAggregate / table calculationThe numeric expression to total across the entire partition. Must be aggregated in the view.

How It Works?

Mathematical / Logical Principle

TOTAL() aggregates values across the entire table calculation partition:

TOTAL = SUM(values across all rows in the partition)

Conceptually, it behaves like a window calculation with a full window, but is easier to read and use.

Return Value

  • Data Type: Numeric (same type as the expression)

  • Meaning:

    • Returns the total value of the expression for the entire partition

    • The value is constant for all rows in the same partition

Example Output

RowValueTOTAL()
A100600
B200600
C300600
 

When Should We Use It?

Use TOTAL() when you need to:

  • Reference overall totals inside calculations

  • Calculate percent-of-total metrics

  • Compare row-level values to group totals

  • Build normalized or proportional KPIs

  • Avoid manual grand total logic

Basic Usage

Return total value for the partition


TOTAL(SUM([Sales]))

Shows total sales repeated on every row

Column Usage

Percent of total calculation


SUM([Sales]) / TOTAL(SUM([Sales]))

Produces percent contribution per row

Difference from total


SUM([Sales]) - TOTAL(SUM([Sales]))

Shows how far each value is from the total

Advanced Usage

Percent of total within partitions


SUM([Sales]) / TOTAL(SUM([Sales]))

(with Compute Using set per Region)

Calculates percent contribution within each region

Rank by percent of total


RANK(SUM([Sales]) / TOTAL(SUM([Sales])))

Ranks categories based on contribution share

Tips and Tricks

  • Always verify Compute Using and partition scope

  • Combine with SUM(), AVG(), or COUNT() for ratios

  • Useful for dashboard KPIs and labels

  • Sensitive to filters and table calculation settings

  • Not usable in row-level or LOD expressions

Related Functions

Functions commonly used alongside or as alternatives to TOTAL():

  • WINDOW_SUM()

  • SIZE()

  • COUNT()

  • RUNNING_SUM()

  • INDEX()

  • RANK_PERCENTILE()

We’ve got plenty of resources to help you master Tableau functions. For more details, check out the official Tableau documentation. Or, if you’re ready for more practice, let’s dive into related functions and build your Tableau skills further!

If you’re ready to harness the full power of Tableau and elevate your data analytics capabilities, our expert Tableau consulting services are here to guide you. Whether you need support with building advanced calculated fields, creating dynamic visual dashboards, or optimizing your data sources for peak performance, our team of experienced Tableau consultants delivers customized solutions designed for your business needs. Visit our Tableau Consulting page to discover how we can help your organization turn data into impactful, insight-driven decisions.

1. What does TOTAL() do in Tableau?

It returns the total value of an expression across the entire table calculation partition.

2. Is TOTAL() affected by filters?

Yes, filters that affect the view also affect the total.

3. Is TOTAL() a table calculation?

Yes, it is evaluated after aggregation and depends on the view layout.

4. Does TOTAL() return different values per row?

No, it returns the same total for all rows in the same partition.

5. How is TOTAL() different from WINDOW_SUM()?

TOTAL() always uses the full partition, while WINDOW_SUM() allows custom window sizes.