/    /  Amazon QuickSight – percentileDisc (percentile)

Amazon QuickSight – percentileDisc (percentile)

 

The ‘percentileDisc()’ function in Amazon QuickSight is used to compute the discrete percentile of a given expression within a group or across the entire dataset. Here is an explanation of the percentileDisc() function:

Syntax

#Start#
percentileDisc(expression, percentile, [group-by level])
#End#

 

This function takes one argument:

 

  • expression: This parameter specifies the expression for which the percentile is to be computed.
  • percentile: This parameter specifies the percentile value to be computed, expressed as a decimal value between 0 and 1.
  • [group-by level]: This parameter is optional and specifies the level of aggregation to be used when computing the percentile. If it is not specified, the percentile is computed across the entire dataset.

 

Suppose we have a dataset that contains information about employee salaries in a company and we want to find the 90th percentile of salaries across all departments. We can use the percentileDisc() function in Amazon QuickSight to do this.

 

To find the 90th percentile of salaries across all departments, we can create a new visual in Amazon QuickSight and add a table with the following settings:

 

Drag the “Salary” measure to the Values section.

Click on the drop-down arrow next to “Salary” and select “PercentileDisc”.

In the “Percentile” field, enter “0.9”.

This will result in a table that shows the 90th percentile of salaries across all departments.

 

Alternatively, we can create a calculated field in Amazon QuickSight with the following expression:

 

Example

#Start#
percentileDisc(Salary, 0.9)
#End#

This expression will compute the 90th percentile of salaries across all departments.

 

For instance, if our salary data is as follows:

EmployeeDepartmentSalary
ASales60000
BSales80000
CMarketing70000
DMarketing50000
EFinance90000
FFinance100000

 

Then, the 90th percentile of salaries across all departments will be:

 

Example

#Start#
percentileDisc(Salary, 0.9) = 90000
#End#

 

In this example, we can see that the percentileDisc() function has computed the 90th percentile of salaries across all departments, resulting in a useful metric that can inform our business decisions. Note that the percentileDisc() function differs from the percentileCont() function in that it returns a value from the dataset, whereas percentileCont() interpolates values between data points.