Adding Percentile Filter in Tableau
Tableau is a business intelligence software that allows anyone to connect to respective data, and then visualise and create interactive, shareable dashboards.
It is not always possible to get the filtered data of your choice with all the calculations done. Some calculations need to done in tableau as well. The segment where this is done in tableau is called calculated field. Sometimes to remove the outliers from the data, it may require adding percentile filter. But adding percentile filter in Tableau is not very straightforward. It requires comparison of aggregated value with the raw data. Here are the steps that need to be followed :
Step I :
Create Parameter for Percentile:
– Create Parameter
– Name Parameter as per choice
– Data Type – String
– Choose List -> Enlist all the percentiles required
Step II :
Create a Calculated field: select value of field for which percentile has to be calculated after applying the filters
Step III:
Create Calculated field for Each Percentile :
– Use include function to aggregate and calculate percentile
e.g, Calculating 95 percentile of total_warehouse_mins, distributing it warehouse_name, logistics_option_code.
{fixed [warehouse_name], [logistics_option_code] : percentile([total_warehouse_mins_filtered],0.95)}
Let’s call this 95_percentile_warehouse_mins
– Create another calculated field to compare the 95 percentile with order level(raw data) data.
if total_warehouse_mins <= 95_percentile_warehouse_mins then TRUE else FALSE
Let’s call this filter_95_percentile
Step IV :
– Follow Step III for all the percentiles
Step V :
– Create another calculated field to select various percentile filter using the parameter.
if parameter = 95 percentile then filter_95_percentile
elseif parameter = 90 percentile then filter_90_percentile and so on
Add this calculated field in the filter and select TRUE.
That’s it. You can now use the percentile parameter to filter data based on percentile and outliers can be removed.
By: Monu Agarwal
Coviam Technologies
Also published on Medium.