Dense Rank Analytic Function

This article describes how to use the Dense Rank analytic function in Arcadia Instant.

We are using the Basic Visual for Single Values to demonstrate how to use the Dense Rank analytic function.

  1. Click a field on the dimension shelf. In this case, choose the population field.

    In the Field Properties menu, select Duplicate.

  2. Click the second population field.

    In Field Properties, expand Analytic Functions, and select Dense Rank.

    Applying Dense Rank
  3. In the Analytic Function: Dense Rank modal window,

    1. 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 dense rank.
    2. 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 (add/plus) icon.

      Here, leave the default order: life expectancy descending, followed by country and GDP, both ascending.

    defining the Dense Rank analytic function
    Analytic Function: Dense Rank
  4. Click Apply.
  5. [Optional] If you examine the expression in the Enter/Edit Expression interface, it shows that the function has the following form:

    DENSE_RANK() over ( order by [life_expectancy], [country], [gdp_per_capita]*[population]) as 'dense rank'
  6. Click Refresh Visual.

  7. Notice that initially, the dense rank numbers are descending, following the order of the primary sorting column, life expectancy. If you sort the table on another column, such as population, the dense rank numbers appear disordered.

    Dense Rank Analytic Function Visual
    Dense Rank Analytic Function Visual