Create a formula in a worksheet

You can define formulas and use them to create derived columns in worksheets.

To create formulas, combine standard functions and operators, column names, and constant values.

Anyone who can create a worksheet can add a formula to it. Formulas are not reusable; the formula you create is associated only with the worksheet it belongs to. A complete list of available formulas and examples of each is available in the Formula function reference.

You can create a formula in a worksheet by using the Formula Builder. When you do this, the result of the formula gets added to the worksheet as a column. Use these steps to create a formula:

  1. Creating worksheets, or Editing or renaming worksheets.

  2. Select the + button next to Formulas.

    Create a new formula for your worksheet
  3. Type your formula in the Formula Builder.

    Use the Formula Builder
    Formula elements are color coded by type and can include the formula operators and functions (blue), the names of columns (purple), and/or constants (black).
  4. You can see a list of formula operators with examples by selecting Formula Assistant.

    Formula Assistant
  5. If you want to change what your formula returns, use the Advanced settings.

    Depending on your formula, you may be able to change:

    • Data type

    • ATTRIBUTE or MEASURE

    • Aggregation type

    Advanced settings in the Formula Builder
  6. Name the formula by selecting its title and typing the new name. Click Save.

Use aggregate formulas as worksheet filters

Starting in ThoughtSpot release 6.2, you can use an aggregate formula as a worksheet filter. This is useful when, for example, you only want your results to show a measure when the related attribute is greater than some number, or vice versa. You may only want to see sales when the unique customer count is greater than 1, or you may only want to see a customer if the associated sales is greater than 0. Rather than add that formula to every search, you can create a filter at the worksheet level.

To add an aggregated formula to a worksheet, follow these steps:

  1. Create an aggregate formula in a worksheet, as shown in the preceding steps 1 through 6.

  2. Add the formula to worksheet as a filter, and specify conditions in which it should apply.