How to Calculate Percentiles in Tableau (3 Functions Compared)

Quick answer:

  • To get the value at the 90th percentile: PERCENTILE([Sales], 0.9)
  • To get each mark’s percentile rank (0–1): RANK_PERCENTILE(SUM([Sales]))
  • To get the 90th percentile of the marks in the view: WINDOW_PERCENTILE(SUM([Sales]), 0.9)

Related: how to find the median in Tableau.

Tableau has a Percentile function:

Percentile(expression, number)

And will return the percentile corresponding to number for the given expression. The Percentile function acts as an aggregate calculation because it takes a set of values as an input and returns a single value. In this case, Percentile takes a set of values and returns the specified percentile for those values.

It’s easier to understand with an example, of course!

percentile calculation

This calculation will return the 75th percentile for the Exam Scores. Here it is in action:

percentile crosstab

  • The 50th percentile for the exam score is 62… so about half the students scored higher and half scored lower.
  • The 75th percentile is 81, so about a quarter of students scored higher.
  • The 0th percentile would give the lowest score on the exam and the 100th percentile would give the highest score

We can add the Gender dimension to the view and see how the percentiles differ:

The Percentile Table Calculation

The Percentile function returns the specified percentile for the underlying data at current level of detail in the view.

Tableau also has a percentile table calculation. This percentile is calculated based on the values in the visualization, rather than the underlying data in the visualization. Here’s what it looks like:

percentile quick table calculation

Notice that the data is aggregated with SUM(Exam Scores). The Percentile table calculation operates on the values after they have been aggregated in the view.

Here’s the test data and the workbook.

Which percentile function should I use?

Need Function Type
Percentile of row-level data PERCENTILE(expr, 0–1) Aggregate
Percentile across marks in the view WINDOW_PERCENTILE(expr, n) Table calc
Where each mark ranks RANK_PERCENTILE(expr) Table calc
Quick option Right-click a measure → Quick Table Calculation → Percentile Table calc

Note: PERCENTILE, like MEDIAN, isn’t available on some live database connections. Use an extract if it’s greyed out.

Show only the top 10%

Create RANK_PERCENTILE(SUM([Sales])) >= 0.9, drag it to Filters, and keep True. Set Compute Using to the dimension you’re ranking, such as Customer.

Percentile reference band

Analytics pane → Distribution Band → Percentiles (for example 10 and 90).

FAQ

How do I calculate the 90th percentile in Tableau?

PERCENTILE([Field], 0.9).

What’s the difference between PERCENTILE and RANK_PERCENTILE?

PERCENTILE returns a value. RANK_PERCENTILE returns each mark’s position from 0 to 1.

How do I get the median with percentile?

PERCENTILE([Field], 0.5). See how to find the median in Tableau.

Are percentiles on the Tableau Data Analyst exam?

Table calculations, including percentile, are in Explore & Analyze Data (41%). Practice with Data Analyst exam questions and read our Data Analyst exam study guide.

Hope this was helpful. Post a comment if you have any questions.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top