KNOWLEDGE BASE

How to use WINDOW_PERCENTILE Function when PERCENTILE Function is not available for some data source type


Published: 22 Dec 2023
Last Modified Date: 26 Dec 2023

Question

For some data source types, PRECENTILE function is not available. This article describes how to use the WINDOW_PERCENTILE function as an alternative to get the same result.

Environment

  • Tableau Desktop 2022.2.2
  • Amazon Redshift

Answer

Assuming we have a crosstab showing the percentile values of each quarter in 2019 on 6th of each month for Binders(Sub-Category).
User-added image

1. Add the [Row ID] field which contains a unique ID value for each row to [Details] mark card.
User-added image

2. Create a calculation field [WINDOW_PERCENTILE] .
IF FIRST()=0 THEN
    WINDOW_PERCENTILE(SUM([Sales]),0.5)
END


3. Add the [WINDOW_PERCENTILE] to the [Text mark] card and right-click on it then click [Compute using] > [Row ID]
User-added image

4. Check the results.

Please refer to Sample.twbx for further details.

Additional Information

PERCENTILE function is available for the following data sources: Non-legacy Microsoft Excel and Text File connections, Extracts and extract-only data source types (for example, Google Analytics, OData, or Salesforce), Sybase IQ 15.1 and later data sources, Oracle 10 and later data sources, Cloudera Hive and Hortonworks Hadoop Hive data sources, EXASolution 4.2 and later data sources.

 
Did this article resolve the issue?