Wednesday, June 28, 2023

Explain the Table Calculation Function 'RUNNING_SUM' in Tableau with Example?

 The RUNNING_SUM function in Tableau is a table calculation function that calculates the cumulative sum of a field or expression over a specified scope or order. It provides the running total of the data points within the defined scope.

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

RUNNING_SUM([expression])

  • [expression]: The field or calculation for which you want to calculate the running sum.

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

Suppose you have a dataset that contains monthly sales data for different products. You want to calculate the cumulative sales for each product over time.

  1. Open Tableau and connect to your dataset.
  2. Create a view that includes the "Product" field, the "Date" field, and the "Sales" field.
  3. Right-click on the "Sales" field in the view and select "Add Table Calculation."
  4. In the Calculation Type drop-down, select "Running Total."
  5. In the "Compute Using" section, choose the appropriate dimensions to define the partitioning and addressing for the calculation (e.g., "Product" and "Date").
  6. Click "OK" to apply the table calculation.

Tableau will calculate the running sum of sales for each product over time. It adds up the sales values starting from the first data point and continues cumulatively with each subsequent data point within the defined scope.

You can further customize the view, apply sorting, or add additional calculations based on the running sum. For example, you can create a visualization that shows the trend of cumulative sales for each product or identify periods with the highest or lowest cumulative sales.

The RUNNING_SUM function allows you to calculate the cumulative sum of a field or expression within a specified scope. It helps you understand the accumulation or progression of the data points over time or within a particular grouping.

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 ...