Wednesday, June 28, 2023

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

 The RUNNING_AVG function in Tableau is a table calculation function that calculates the running average of a field or expression over a specified scope or order. It provides the average value of data points observed up to the current data point within the defined scope.

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

RUNNING_AVG([expression])

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

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

Suppose you have a dataset that contains monthly sales data for different products. You want to calculate the running average 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 Avg."
  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 average sales for each product over time. It computes the average of sales values starting from the first data point and continues updating the average 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 average. For example, you can create a visualization that shows the trend of the average sales for each product or identify periods with higher or lower average sales.

The RUNNING_AVG function allows you to calculate the running average of a field or expression within a specified scope. It helps you understand the average value of data points observed up to the current data point and track the average 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 ...