Tableau Funtion: WINDOW_MAX( )

Tableau Function: WINDOW_MAX( )

Category: Table Calculation Functions

What Is the Function?

Purpose of the Function

The WINDOW_MAX() function in Tableau is a table calculation that returns the maximum value of an expression within a defined window of rows in a partition.

In simple terms, WINDOW_MAX() answers:
“What is the highest value within this specific window?”

Unlike RUNNING_MAX(), which accumulates progressively, WINDOW_MAX() allows you to define a custom range over which the maximum is calculated.

Type of Calculations

  • Table calculations

  • Window-based aggregations

  • Maximum value calculations

  • Order-dependent analytics

It evaluates values within a specified window relative to the current row.

Practical Use Cases

  • Creating rolling maximum values

  • Identifying peak performance within time ranges

  • Highlighting highest value in a category

  • Comparing current value to local maximum

  • Detecting breakout or spike events


WINDOW_MAX(expression, [start, end])

ParameterTypeDescription
expressionAggregate / table calculationNumeric expression whose maximum will be evaluated. Must be aggregated.
start (optional)IntegerStarting row offset relative to the current row.
end (optional)IntegerEnding row offset relative to the current row.

How It Works?

Mathematical / Logical Principle

  1. Collect values within defined window

  2. Evaluate maximum among those values

Conceptually:

WINDOW_MAX = MAX(values within specified window)

The window is determined relative to the current row.

Return Value

  • Data Type: Numeric (same as expression)

  • Meaning:

    • Returns the maximum value within the defined window

    • May vary for each row depending on window boundaries

When Should We Use It?

Use WINDOW_MAX() when you need to:

  • Calculate rolling maximums

  • Identify local peaks

  • Compare values against nearby highs

  • Analyze top performance within a window

  • Build threshold-based alerts

Basic Usage

Full partition maximum


WINDOW_MAX(SUM([Sales]))

Returns the overall maximum Sales value

Column Usage

3-period rolling maximum


WINDOW_MAX(SUM([Sales]), -2, 0)

Evaluates current row and previous two rows

Centered rolling maximum


WINDOW_MAX(SUM([Sales]), -1, 1)

Evaluates previous, current, and next rows

Advanced Usage

Compare value to rolling maximum


SUM([Sales]) / WINDOW_MAX(SUM([Sales]), -2, 0)

Calculates ratio to recent peak

Dynamic window with parameter


WINDOW_MAX(
SUM([Sales]),
-[Window Size],
0
)

Allows interactive rolling maximum

Tips and Tricks

  • Always verify Compute Using settings

  • Ensure correct sorting for time-based analysis

  • Combine with WINDOW_MIN() to analyze range

  • Window exceeding partition boundaries adjusts automatically

  • Sensitive to partition size

Related Functions

Functions commonly used alongside or as alternatives to WINDOW_MAX():

  • RUNNING_MAX()

  • WINDOW_MIN()

  • WINDOW_AVG()

  • WINDOW_SUM()

  • LOOKUP()

  • INDEX()

We’ve got plenty of resources to help you master Tableau functions. For more details, check out the official Tableau documentation. Or, if you’re ready for more practice, let’s dive into related functions and build your Tableau skills further!

If you’re ready to harness the full power of Tableau and elevate your data analytics capabilities, our expert Tableau consulting services are here to guide you. Whether you need support with building advanced calculated fields, creating dynamic visual dashboards, or optimizing your data sources for peak performance, our team of experienced Tableau consultants delivers customized solutions designed for your business needs. Visit our Tableau Consulting page to discover how we can help your organization turn data into impactful, insight-driven decisions.

1. What does WINDOW_MAX() do in Tableau?

It returns the maximum value within a defined window of rows.

2. How is WINDOW_MAX() different from RUNNING_MAX()?

WINDOW_MAX() uses a custom range, while RUNNING_MAX() accumulates progressively.

3. Is WINDOW_MAX() affected by sorting?

Yes, sorting determines row order within the window.

4. Can WINDOW_MAX() be used for rolling analysis?

Yes, by specifying row offsets.

5. Does WINDOW_MAX() adjust when window exceeds boundaries?

Yes, Tableau automatically adjusts the window to fit within the partition.