Sometimes you may want to show a rolling average of data to see more general trends in values over time. You can either 1) set this up for a variable set directly so it is analyzed this way in tables and visualizations, see Rolling Averages for Tables, or 2) use a Table rule to roll to create the rolling average values for the individual table or visualization. This article covers the second method which describes how to apply a table rule to go from a crosstab with a Date/Time variable set...
...to a table or visualization with a lagged rolling (aka smoothing or moving) average:
Requirements
- A table or visualization with a Date/Time variable.
- You may not have a NET in the variable containing the dates.
Note: You must apply the rule directly to the input table if you see a table icon in the Data > Data Source > Data field in the Properties of a visualization.
You will also see a warning in the Rules section of Properties if you have applied a rule directly to a non-compatible visualization, and you will need to apply it to the input table instead. For example:
Method
- Select your table or visualization.
- Go to Data > Rules in Properties
.
- Select Plus (+) > Cell Content > Replace Value with Rolling Average.
- Set the Number of periods to roll.
- OPTIONAL: Tick Dates are in the rows if applicable.
- Press OK.
Technical details
- The statistical testing results in the table are NOT changed by this rule. That is, they reflect the results for the original, unrolled statistics.
- A lagged rolling average is computed. For example, if January has a score of 3, February 4, and March 6, the 3-period rolling average for March is (3 + 4 + 6) / 3 = 4.33333333.
- Where values cannot be computed due to insufficient data, the value is shown as NaN. For example, if January has a score of 3, February 4, and March 6, the 3-period rolling average for the three months, respectively, are NaN, NaN, and 4.33333333.
- This rule is only applied to the first statistic selected in each of Statistics > Cells and whichever is appropriate of Statistics > Below and Statistics > Right.
UPCOMING WEBINAR: Build it once. Use it again: Create reusable charts with AI