Wednesday, June 28, 2023

Explain the Aggregate Function ' SUM' in Tableau with Example?

In Tableau, the SUM function is an aggregate function used to calculate the sum of a numeric field within a specified context or group. It allows you to find the total value of a field by adding up all the values.

The syntax for the SUM function in Tableau is as follows:


where the expression is the field or calculation for which you want to calculate the sum.

Here's an example to demonstrate how to use the SUM function in Tableau:

Suppose you have a dataset that contains information about the sales of different products in a company. You want to calculate the total sales across all products.

  1. Open Tableau and connect to your dataset.
  2. Drag the "Sales" field to the Columns shelf.
  3. In the Marks card, change the aggregation of the "Sales" field to "Sum" by clicking on the drop-down arrow next to the field and selecting "Sum."
  4. This applies the SUM function to the "Sales" field and calculates the total sales.
  5. Tableau will display the sum of the sales in the view.

The result will show you the total sales value across all products. This allows you to understand the overall revenue generated by the company.

The SUM function can also be used with other aggregate functions or in combination with other calculations to perform more complex analyses. For example, you can calculate the percentage contribution of each product to the total sales by dividing the individual product sales by the sum of all sales.

In summary, the SUM function in Tableau allows you to calculate the sum of a numeric field, providing insights into the total value or quantity in your dataset. 

No comments:

Post a Comment

If you have any doubts. Please let me know

How can you create an alias for a table in a SQL query?

In SQL, you can create an alias for a table in a query to give the table a temporary, alternative name that you can use in the query. Table ...