Moving formulas smooth out irregularities in your data across a defined window, making trends easier to recognize.Moving formulas smooth out irregularities in your data so trends are easier to recognize. Larger intervals smooth out more peaks and troughs; smaller intervals keep the moving formula closer to the actual data points.
Syntax
Each moving formula accepts a Measure, two integers defining the window or interval, and one or more optional attributes:moving_sum() functions as sum(). When you specify both required and optional values, the formula returns the aggregate of the Measure over the provided attributes for the defined window.
Invoca determines the window with the following formula:
(1,1) contains 3 rows total: one row before the current row, the current row, and one row after. You can emulate “lag” by specifying negative values for the window — for example, a window of (1,-1) contains only 1 row, the one that precedes the current row.
NoteWhen the windowing attribute is character-based, Invoca orders values alphanumerically to determine row order for the window calculation.
The moving formulas
Calculate a moving average
- Start a new search.
- In the upper-right of the table, click the more options menu icon and select Add formula.
- Enter the
moving_averageformula, specifying a Measure, the window, and one or more attributes. - Name the formula by entering a title in the top field, then click Save. It appears in the search bar and as its own table column, with a box showing the moving average within the entire table at the bottom of the chart.
- To use a different aggregation type, click the current aggregation type at the bottom of the box and select another.