Next Value Analytic Function

This article describes how to use the Next Value analytic function in Arcadia Instant.

We are using the Basic Visual for Aggregates to demonstrate how to use the Next Value analytic function.

  1. Click the field on the measurement shelf, in this case, the sum(population) field on the Y Axis shelf.
  2. In the Field Properties menu, expand Analytic Functions, and select Next Value.
    Applying Next Value analytic function
  3. In the Analytic Function: Next Value modal window,

    1. In Select aggregate for this measure, leave the default Sum. The other aggregation options are Count, Minimum, Maximum, and Average. In addition, some connection types also support Approximate Distinct Count and Exact Distinct Count.
    2. Under Select entities over which to tale next value, select state. This is the grouping that applies when calculating next values.
    3. Under Select the sort order, click the (add/plus) icon, select year, and then set it to ascending sort order. This order specifies what determines what the next row is, and the row where the value is taken.

      Note that you can add additional sort parameters, by clicking the (add/plus) icon.

    4. Under Offset, specify the number of next rows over which the function executes.

    defining the Next Value analytic Function
    Analytic Function: Next Value
  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:

    LAG(sum([population]), 1) over (partition by [year] order by [year], [country]) 
      as 'next value(population)'
  6. Click Refresh Visual.

  7. Notice the change to the appearance of the visual, and the change in values that appear on the tooltip.

    Next Value Analytic Function Visual
    Next Value Analytic Function Visual