This article describes how to use the Percent Difference from Previous Value analytic function in Arcadia Enterprise.
Create a basic line visual on the World Life Expectancy
dataset, through an
Arcadia data connection. See Basic Visual for Aggregates.
In our example, we compare the difference in population of Libya in the year 1965 and the previous year 1964.
sum(population)
field on the Y Axis shelf.In the Analytic Function: Percentage Difference from Previous Value modal window,
Under Select the sort order, you can specify the order of sorting. This order specifies what the previous 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, edit the sort order to be: country ascending, followed by year ascending.
(sum([population]) - LAG(sum([population]), 1) over (partition by [country] order by [country], [year])) / LAG(sum([population]), 1) over (partition by [country] order by [country], [year]) as 'pct diff from prev(population)'
Click Refresh Visual.
Notice the change in the appearance of the Y axis and the tooltip, from displaying
the sum(population)
in millions to population
as a
percentage difference from previous value.
Hover over any country to view the percentage difference of population from the previous year. In the following example, the tooltip shows an increase in the population of Libya from previous year 1964 to the current year 1965 by 3.92%.