Amazon QuickSight – percentileCont
The ‘percentileCont()’ function in Amazon QuickSight is used to compute the continuous percentile of a measure or expression over a specified group. Here is an explanation of the percentileCont() function:
Syntax
#Start# percentileCont(expression, percentile, [group-by level]) #End#
This function takes one argument:
- expression: This parameter specifies the measure or expression for which the continuous percentile is to be computed.
- percentile: This parameter specifies the percentile value to be computed, which must be a value between 0 and 1.
- [group-by level]: This optional parameter specifies the level at which the computation should be grouped.
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 percentileCont() 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 “PercentileCont”.
- 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# percentileCont(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:
| Employee | Department | Salary |
| A | Sales | 60000 |
| B | Sales | 80000 |
| C | Marketing | 70000 |
| D | Marketing | 50000 |
| E | Finance | 90000 |
| F | Finance | 100000 |
Then, the 90th percentile of salaries across all departments will be:
Example
#Start# percentileCont(Salary, 0.9) = 98000 #End#
In this example, we can see that the percentileCont() function has computed the 90th percentile of salaries across all departments, resulting in a useful metric that can inform our business decisions.