TIBCO Cloud™ Spotfire® Web Client User Guide

Year to Date Growth

The Year to Date Growth expression shortcut calculates the relative difference between the cumulative sums for consecutive years. This shortcut is only applicable when you are having a time hierarchy including year on the X-axis.

Example

As starting point, the bar chart below is used. It shows the quarterly sums of sales for three years.



In the next bar chart, the shortcut expression Year to Date Growth has been applied on the Value axis. (The arrow points to a bar used to explain what is calculated in the expression further down.)



The following expression is used on the Value axis.

Sum([Sales]) THEN Sum([Value]) OVER (Intersect(AllPrevious([Axis.X]), NavigatePeriod([Axis.X],"Year",0.0)))THEN ([Value]/First([Value]) OVER (NavigatePeriod([Axis.X],"Year",-1)))-1

The first part of the expression specifies that the column [Sales] should be aggregated as a sum. The result of this part goes into the [Value] column to be used in the expression following THEN.

In the part between the THEN keywords, the nodes within the intersection of two node navigation methods are summed; the AllPrevious() method and the NavigatePeriod() method. The intersections will result in periods that begin with Q1 each year and end with the quarter to calculate the value for, that is, it is a Year to Date Total calculation.

In the part after the second THEN, each node gets divided by the corresponding node one year ago (because the number of steps is set to -1, see NavigatePeriod() for details). This result is then subtracted by 1 to get the percentage.

The aggregation First() is just used because an aggregation is required before the OVER keyword. It will take you to the first value of the node to subtract, but since each node only has one value, this corresponds to picking the value of the node.

For example, calculation of the Year to Date Total for Q2, 2021 (see the arrow in the previous image):

-48%=($350+$300)/($650+$600) - 1

(See the bars within the intersection of the black rectangles. Adding them gives the year to date sum for Q2, 2021. In the same way, adding the bars within the intersection of the red rectangles gives the year to date sum for Q2, 2020. The percentage difference between those sums is then calculated.)



The column selector in expanded mode

In the installed client, the extended column selector offers controls that make it easy to change various parameters in the expression shortcut:



Display name Optionally, specify a different display name instead of the default "Year to Date Growth ([Column Name])".
Axis Specify the axis over which to calculate the nodes.

Only categorical axes that perform some kind of grouping can show up in the drop-down list. This means that if you only have a grouping on the X-axis, then this is the only axis available, whereas if you also have colored by a categorical column then the Color axis will be available as well, and so on.

Hide Empty Values Creates a Show/Hide rule that hides all empty values. Click the properties symbol to access the Show/Hide properties to edit or remove the rule.
Formatting Change the formatting of the axis. For example, change to Number to show the values in numbers rather than as percentage.