Skip to main content

 

ThoughtSpot

Calculate the moving average

Moving window formulas video

 

Overview

Explains what the feature is or what its benefits are to the user or customer.

Feature

You can use the moving formulas to compute a measure within a moving window of your data, usually defined by time.

This example will demonstrate using the moving_average formula. To use the moving function in a search:
  1. Start a new search.

    Figure: Aggregation Answer example

    File:01_The_Basics/User_Guide_3.5/030/040/030/010/aggregation_answer.png
  2. In the upper right hand side of the table, click Actions and select Add formula.

    Figure: Create a new formula in an answer

    File:01_The_Basics/end_user_guide_bookmap/030/040/030/010/create_formula_in_answer.png
  3. Enter the moving_average formula, providing a measure, a window, and one or more attributes. The example will return the average of revenue, within the commit date window size of 3. The window includes the previous, current, and next rows.
    The attributes are the ordering columns used to compute the moving average. The window is (current - Num1...Current + Num2) with both end points being included in the window. For example, "1,1" will have a window size of 3. To see periods in the past, use a negative number for the second endpoint, as in the example "moving_average(sales, 1, -1, date)".

    Figure: Moving Average Formula

    File:01_The_Basics/end_user_guide_bookmap/030/040/030/010/moving_average_formula.png
  4. Name the formula by clicking on its title and typing the new name. Click Save.
  5. The formula will appear in the search bar and in the table as its own column.

    Figure: Moving Average Table

    File:01_The_Basics/end_user_guide_bookmap/030/040/030/010/moving_average_table.png

    A box displaying the moving average within the entire table will appear at the bottom. You can click on it to toggle between aggregation types.

  • Was this article helpful?