SUM () and TOTAL () functions in Tableau (2024)

What is the difference between SUM and TOTAL functions in Tableau?

SUM – is an aggregate function used to sum all the values in an expression. Note, SUM can be used with numeric fields ONLY.

Syntax: SUM(<Value>)

TOTAL – is a table calculation function that returns the total of a given expression. (Takes whatever expression you give it and computes the total for the whole data in the partition). Note, TOTAL is not limited to numeric fields like in the case of SUM function.

Syntax: TOTAL(SUM(<Value>)) (Note you can use different aggregate other than SUM)

Example

Looking at the view below, the SUM function computes the total sales for each Region (sums all sales per region), while the TOTAL function sums all sales for the entire partition (entire data).

Where Total = TOTAL(SUM([Sales]))

(Note, TOTAL being a table calculation function, you can customize how the calculation is executed - which in certain cases (based on the direction of computation) will result to the same value as the SUM function).

SUM () and TOTAL () functions in Tableau (3)

Note adding SUM(Sales) and TOTAL(SUM(Sales)) to a view which is not segmented by any dimension - results to the same value (as the two functions are computed at data source level).

SUM () and TOTAL () functions in Tableau (4)

Using TOTAL function to compute sample size in survey analysis

When analyzing survey data, the TOTAL function becomes even more helpful in computing the sample size of your survey. For instance, using the calculation below – where Respondent_ID is the unique identifier of each respondent in your data, you can compute the sample size (total number of respondents) for each survey question as well as for the entire survey as follows.

SUM () and TOTAL () functions in Tableau (5)

I hope this article was helpful to you. To receive more of the Tableau tips and tricks, kindly join our mailing list by subscribing below.

Thank you for reading

SUM () and TOTAL () functions in Tableau (2024)
Top Articles
Latest Posts
Article information

Author: Domingo Moore

Last Updated:

Views: 5817

Rating: 4.2 / 5 (53 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Domingo Moore

Birthday: 1997-05-20

Address: 6485 Kohler Route, Antonioton, VT 77375-0299

Phone: +3213869077934

Job: Sales Analyst

Hobby: Kayaking, Roller skating, Cabaret, Rugby, Homebrewing, Creative writing, amateur radio

Introduction: My name is Domingo Moore, I am a attractive, gorgeous, funny, jolly, spotless, nice, fantastic person who loves writing and wants to share my knowledge and understanding with you.