Rank Analytic Function
This article describes how to use the Rank analytic function in CDP Data Visualization.
Click a field on the dimension shelf. In this case, choose the
- In the Field Properties menu, select Duplicate.
Click the second
In Field Properties, expand Analytic
Functions, and select Rank.
In the Analytic Function: Rank modal window,
- Under Select entities over which to calculate rank, you can select any of the fields: country, life expectancy, or GDP. This is the grouping that applies when calculating the rank.
Under Select the sort order, you can specify the order of sorting. This order specifies what the row is, and the row where the value is taken. If your visual already specifies sorting order, these values appear in the modal.
You can add additional sort parameters, by clicking the Plus icon.
Here, leave the default order: life expectancy descending, followed by country and GDP, both ascending.
- Click Apply.
If you examine the expression in the Enter/Edit Expression
interface, it shows that the function has the following form:
RANK() over ( order by [life_expectancy], [country], [gdp_per_capita]*[population]) as 'rank'
- Click Refresh Visual.
Notice that initially, the rank numbers are descending, following the order of
the primary sorting column, life expectancy. If you sort the table on another
column, such as GDP, the rank numbers appear disordered.