Sometimes it is useful to look at numerical data in an aggregated form such as a summation or an average. The mathematical functions that produce aggregated data are called aggregation functions. Aggregation functions perform a calculation on a set of values and return a single value.
You can use Tableau to set an aggregation only for measures in relational data sources. Multidimensional data sources contain aggregated data only.
Aggregation defines how values are expressed. Most Tableau functions are calculated at the database server with only the results being sent to Tableau. If you are familiar with SQL, you will find most of the functions in Tableau are an extension of SQL. Tableau uses the Sum aggregation by default. If the default aggregation isn’t what you want, point at the pill of the measure you’ve placed into the view—right-click, and select more appropriate aggregation functions.
Want to Learn Advanced Calculations & Chart Techniques to Create Innovative Analysis & Dashboards? Then enroll in Mindmajixs' MindMajix Tableau e learning |
Here are the types of Tableau Aggregate Functions:
These are clearly defined in Tableau’s online manual. Search the help menu to read more about each of them if you are unfamiliar with the type of aggregation each provides.
Related Article: Tableau Basics |
One of the aggregate functions you can use in Tableau is Count (Distinct), which returns the number of unique values in a field.
These functions count records in different ways. Consider a data set that includes 10,000 records with 20 different regions. Performing a Count Distinct on the Region field returns a value of 20. The purpose of Count Distinct is to count the unique instances of a particular item. A Count aggregation of 10,000 records will result in an answer of 10,000 only because it counts all records.
Count Distinct is supported by relational database sources but is not supported by Excel, Access, or text files. You can add the ability to create Count Distinct aggregation when accessing those sources by performing a data extract. Tableau’s extract files do support Count Distinct aggregation.
Most data sources and all extracts support MEDIAN in Tableau as a standard aggregation.
However, Median is not supported by a direct connection from Tableau to Excel, Access, or text files. Performing a data extract will once again give you the ability to compute median values. Using the Superstore data set, figure 4.1 shows a crosstab displaying, all of the different aggregations available for the sales field in the data set.
Different aggregation of sales Diagram
Notice that the bottom four rows are expressing Count Distinct values for different dimensions. By dragging each of those dimension fields into the crosstab using the right mouse button, the Count Distinct aggregation is expressed for each dimension. As you can see the data set includes over 5,000 different orders; over 1,400 cities; 48 states; and four regions.
When converted to an attribute, the dimension becomes just a label. In other words, it is not used to partition the data.
Aggregation behavior can be changed by altering the default method by which Tableau expresses dimensions. Figure 4.2 shows a crosstab containing sales by product category and sub-category. A table calculation is being used to display the percent of total sales that each row represents within each product category pane.
By default, Tableau partitions the result by the category dimension. Subtotals have been added by using the main menu option analysis/ totals, then showing subtotal and column totals. You can see that in each category pane the number of sales and percent of sales is totaled. But, if the category dimension is changed to an attribute, the category dimension will become a label only and no longer cause the data to be partitioned. Figure 4.3 shows the same dataset but with the category, the field changed to an attribute.
Related Article: Tableau Interview Questions and Answers for Experienced |
Diagram of Product category as a dimension
Diagram of Product category as an attribute
The view still shows the light gray boundary lines between each category, but because the category dimension has been changed to an attribute, it will no longer partition the view. The sales total reflects the total for the entire crosstab and the percent of total sales is now expressing the percentage of total sales, but not the sales within each category. This may appear to be trivial, but as your skills advance and you begin to employ more advanced table calculations you get to understand how attributes change Tableau’s behavior.
List Of Tableau Courses:
Tableau Advanced |
Tableau Server |
Data Visualization and Dashboarding Fundamentals |
Name | Dates | |
---|---|---|
Tableau Training | Nov 02 to Nov 17 | View Details |
Tableau Training | Nov 05 to Nov 20 | View Details |
Tableau Training | Nov 09 to Nov 24 | View Details |
Tableau Training | Nov 12 to Nov 27 | View Details |
As a Senior Writer for Mindmajix, Saikumar has a great understanding of today’s data-driven environment, which includes key aspects such as Business Intelligence and data management. He manages the task of creating great content in the areas of Programming, Microsoft Power BI, Tableau, Oracle BI, Cognos, and Alteryx. Connect with him on LinkedIn and Twitter.