Tableau WINDOW_AVG Function

×

Definition

WINDOW_AVG is a Tableau Table Calculation function. It returns the average of the expression within the window. The function accepts offsets from the current row as parameter values to determine the start and end positions.
×

How to use WINDOW_AVG function

The WINDOW_AVG function returns the average of the expression defined by the offsets provided. If we provide no values for the start and end, then it calculates average for all rows. WINDOW_AVG ( expression , [ start , end ] )
×

Use WINDOW_AVG function in a formula

The WINDOW_AVG function below calculates the average of the sum of Price starting from the first row to the last row of the window. WINDOW_AVG ( SUM ( [Price] ) , FIRST() , LAST() )
×

Use WINDOW_AVG function with current row

The WINDOW_AVG function here calculates the average of the sum of Price starting from the third row to the current row of the window. The 0 offset indicates the current row. WINDOW_AVG ( SUM ( [Price] ) , FIRST() + 2 , 0 )
×

Example of WINDOW_AVG in Tableau

WINDOW_AVG function calculates the average of the expression for all the rows from the start and end offsets provided as parameter. In the below example, the offsets provided are FIRST() and LAST(), so all the rows are considered.


×

Recommended Read

The offsets from the current row accepted by WINDOW_AVG as parameters make it very powerful and flexible to adapt to various calculation scenarios. Often we may need to use the average of only the rows available in the window, WINDOW_AVG makes it possible.
× The WINDOW_AVG function is useful in many LOD calculations when we want to utilize the average value of the rows displayed in the particular window only.