Tableau Funtion: WINDOW_PERCENTILE( )
Tableau Function: WINDOW_PERCENTILE( )
Category: Table Calculation Functions
What Is the Function?
WINDOW_PERCENTILE() is a table calculation function in Tableau that returns the specified percentile value within a defined window (range of rows) in a visualization.
Purpose
It calculates the value below which a given percentage of observations fall within the current partition (window).
Type of Calculation
Table Calculation
Operates on aggregated measures
Computed after the data is returned to Tableau
Depends on partitioning and addressing settings
Practical Use Cases
Finding the 90th percentile of sales within each region
Identifying top-performing products based on percentile ranking
Outlier detection
Performance benchmarking
SLA threshold monitoring
Distribution analysis in dashboards
WINDOW_PERCENTILE(expression, percentile, [start, end])
| Parameter | Type | Description |
|---|---|---|
expression | Column (Aggregated Measure) | The numeric field to evaluate (e.g., SUM(Sales)) |
percentile | Scalar (Float between 0 and 1) | The percentile to compute (e.g., 0.9 for 90th percentile) |
start | Scalar (Integer, Optional) | Offset from the current row defining the start of the window |
end | Scalar (Integer, Optional) | Offset from the current row defining the end of the window |
How It Works?
Mathematical Principle
The percentile represents a position in an ordered dataset.
Formula for position:
Where:
n= number of valuespercentile= desired percentile (0–1)
Tableau:
Sorts the values within the window
Determines the percentile position
Uses interpolation if necessary
Example:
Values: 10, 20, 30, 40, 50
90th percentile:
Interpolated between 40 and 50 → Result ≈ 46
Return Value
Data Type: Numeric (same type as
expression)Meaning: Returns the value at the specified percentile within the defined window.
Example:
If calculating the 90th percentile of sales, it returns the sales value below which 90% of values fall.
When Should We Use It?
Use WINDOW_PERCENTILE() when:
You need dynamic percentile thresholds in dashboards
Comparing performance within partitions (Region, Category, etc.)
Creating conditional formatting based on percentile
Detecting statistical outliers
Calculating rolling percentiles
Basic Usage
Calculate the median (50th percentile):
WINDOW_PERCENTILE(SUM(Sales), 0.5)
Column Usage
Calculate 90th percentile of Sales within each Region:
WINDOW_PERCENTILE(SUM(Sales), 0.9)
Set:
Compute Using → Table (Down)
Partition by → Region
Advanced Usage
Rolling 75th Percentile (Last 6 Months)
WINDOW_PERCENTILE(SUM(Sales), 0.75, -5, 0)
This calculates the 75th percentile over:
Current month
Previous 5 months
Conditional Highlighting (Top 10% Performers)
IF SUM(Sales) >= WINDOW_PERCENTILE(SUM(Sales), 0.9)
THEN "Top 10%"
ELSE "Others"
END
Tips and Tricks
- Always verify Compute Using settings
- Sort data correctly (percentiles depend on order)
- Use
WINDOW_PERCENTILE()with partitions for grouped analysis - Use for dynamic benchmark lines
Common Pitfalls:
Forgetting that it is a table calculation
Using non-aggregated measures
Misconfigured partitioning
Expecting database-level performance
Related Functions
PERCENTILE()(Aggregate function at database level)WINDOW_AVG()WINDOW_MEDIAN()WINDOW_SUM()RANK_PERCENTILE()RUNNING_PERCENTILE()
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.
PERCENTILE() is an aggregate function computed at the database level, while WINDOW_PERCENTILE() is a table calculation computed within Tableau.
Yes. Use 0.5 as the percentile:
WINDOW_PERCENTILE(SUM(Sales), 0.5)Yes. Percentile calculations depend on the sorted order within the partition.
Yes, using start and end parameters:
WINDOW_PERCENTILE(SUM(Sales), 0.75, -5, 0)Most likely due to incorrect partitioning or Compute Using settings.