direction
Returns the change direction for a series of numbers. Specifically, the function checks if the last value in a list or table region (e.g. a column) represents an increase or decrease relative to the first value.
The function returns one of these string values:
- 'up' — when the last value is greater than the first; 
- 'down' — when the last value is less than the first; or 
- 'stable' — when the first and last values are equal. 
This function is often used with time-series data (e.g. a series of stock prices) to determine the general trend.
Parameters
- X (list or table region) - A list or table region of numbers. 
Examples
The function can take a list of numbers.
| ATL in Script | Result | 
|---|---|
| 
 | up | 
| 
 | down | 
| 
 | stable | 
Using direction with table data
Assume a "Describe the Table" project with this data:
| Month | Sales | Profit | |
|---|---|---|---|
| Row 1 | January | 1,252,781.57 | 50,111.26 | 
| Row 2 | February | 1,046,028.91 | 48,263.78 | 
| Row 3 | March | 1,231,745.34 | 51,258.92 | 
The function can take a column variable.
| ATL in Script | Result | 
|---|---|
| 
 | down | 
| 
 | up | 
Note
In a "Describe Row in Context" project, the column variables are SalesColumn and ProfitColumn.