Using Calculated Data Series

Calculated Data Series allows you to chart custom calculations while still leveraging all of the benefits of Data Explorer: dynamic groupings and date ranges, chart transforms, and dashboard filtering.

When adding a Calculated Data Series, you can enter complex formulas referencing the columns in your transactional table of data. These calculations are dynamic, when the date grouping or date range of your metric changes, the expression is re-run and the chart displays the correct results.

Expressions in Calculated Data Series follow a Google Sheet like syntax for aggregations and mathematical operators. For example, if you wanted to calculate Average Deal Size, you would enter this expression:

`SUM([Deal Amount])/COUNT([id])`

You can also leverage conditional aggregations like SUMIFS and COUNTIFS, so that you can create advanced calculations without SQL knowledge.

Calculated Data Series are only supported in the Data Explorer Metric Builder.

To add a Calculated Data Series, select +Add data series on the Chart Tab of the Metric Builder. Instead of selecting a column from your table of data, select "Calculate a Data Series" at the bottom of the dropdown. This will open the "Calculate a Data Series" modal where you enter the calculation you would like to add to the chart.

In the Calculated Data Series modal, start typing in the box to enter your expression. Grow provides a helpful autofill to help guide you in entering a valid expression. You can start typing aggregations or column names and the autofill will suggest the correct syntax.

Please note that any column you want to reference from your transactional table of data must be wrapped by an aggregation (with the exception of criteria columns in conditional aggregations). Columns must be wrapped by an aggregation because of the dynamic groupings in Data Explorer, you must tell Grow what aggregation you want to use when grouping your transactional data.

Column Title

You must enter a Column Title in order to save a Calculated Data Series. Column Titles must be unique from both the column names in the table of data and the names of other Calculated Data Series.

Supported Syntax and Examples

Calculated Data Series uses Google Sheets like syntax for all Basic Aggregations and Conditional Aggregations. However, please note that the syntax for column names and syntax highlighting for different arguments is the same as Calculated Columns on the Data Tab. Calculated Data Series also supports the same operators as the Filter Transform.

The following operators and aggregations are currently supported in Calculated Data Series:

Basic Aggregations

Syntax Description
`SUM([column_name])` sum of range
`COUNT([column_name])` count of range (includes blanks)
`AVERAGE([column_name])` average of range
`MAX([column_name])` maximum of range
`MIN([column_name])` minimum of range
`COUNTUNIQUE([column_name])` unique count of range (does not count blanks)

Mathematical Operators

When using multiple mathematical operators in the same expression, please note the calculation will respect order of operations.

Syntax Description
`+` addition
`-` subtraction
`*` multiplication
`/` division

Expression Examples

`MAX([Deal Amount])`

This expression finds the largest sale value over the selected grouping

`SUM([Deal Amount])/COUNT([id])`

This expression runs the sum of sales divided by the total number of orders over the selected grouping, calculating average order value.

Conditional Aggregations

Syntax Description
`SUMIFS([column_name],[criteria_column1], "criteria1",[criteria_column2],"criteria2",...)` returns the sum of a column depending on the criteria specified
`COUNTIFS([column_name],[criteria_column1], "criteria1",[criteria_column2],"criteria2",...)` returns the count of values in a column depending on the criteria specified
`AVERAGEIFS([column_name],[criteria_column1], "criteria1",[criteria_column2],"criteria2",...)` returns the average of a column depending on the criteria specified
`MAXIFS([column_name],[criteria_column1], "criteria1",[criteria_column2],"criteria2",...)` returns the max value of a column depending on the criteria specified
`MINIFS([column_name],[criteria_column1], "criteria1",[criteria_column2],"criteria2",...)` returns the min value of a column depending on the criteria specified
`COUNTUNIQUEIFS([column_name],[criteria_column1], "criteria1",[criteria_column2],"criteria2",...)` returns the unique count of values in a column depending on the criteria specified

Parameter Definitions

1. `[column_name]`the column to perform the aggregation on (ex: the column to be summed or counted)

2. `[criteria_column]`the column (or range) to check the specified criteria against

3. `"criteria"` the specified criteria to run against the criteria column

4. `[criteria_column2],"criteria2",...`additional columns (or ranges) and criteria to check

Filter Operators

Syntax Description
`=` equals
`<>` does not equal
`>` greater than
`>=` greater than or equal to
`<` less than
`<=` less than or equal to
`CONTAINS("criteria")` checks for cells that contain defined string criteria
`DOESNOTCONTAINS("criteria")` checks for cells that do not contain defined string criteria
`ISONEOF("criteria1","criteria2",...)` checks for cells that equal defined criteria
`ISNOTONEOF("criteria1","criteria2",...)` checks for cells that do not equal defined criteria
`ISBLANK` checks for empty cells
`ISNOTBLANK` checks for non-empty cells

Syntax Notes

• Criteria specified in `CONTAINS()`, `DOESNOTCONTAIN()`, `ISONEOF()`, `ISNOTONEOF()` is not case sensitive
• You can apply the `CONTAINS()` or `DOESNOTCONTAIN()` operator on any data type (text, numeric, or date column).

Expression Examples

`SUMIFS([sales], [sales_rep], "Austin")`

This expression sums Austin's sales over the selected grouping.

`SUMIFS([order_id], [lead_source], ISONEOF("Social", "Paid"))`

This expression sums the number of orders where the lead source equals "Social" or "Paid."

`COUNTIFS([order_id], [sale_amount], ">100", [type], CONTAINS("New"))`

This expression counts the number of orders where the sale amount is greater than 100 and the customer type contains the string "New"

`COUNTIFS([order_id], [sales_amount], ">100", [customer_type], ISNOTBLANK)`

This expression counts the number of orders where the sale amount is greater than 100 and customer type is not blank

`COUNTIFS([Deal Amount], ">100")`

This expressions counts the number of deals where the deal amount is greater than 100

You will notice this expression does not explicitly define the criteria_column. If you are entering a single criteria conditional aggregation, and the column you are aggregating is the same column you wish to run your criteria against, you do not need to specify the criteria_column.

Edit a Calculated Data Series Expression

To edit a Calculated Data Series expression, simply click the pencil of the Data Series you would like to edit. Upon clicking the pencil, you will be presented with the Calculated Data Series model where you can edit your expression or Column Title. You must click "Save" or "Cancel" to exit the model. Clicking "Cancel" will not save any changes made to the expression or the title.

Calculated Data Series and Data Explorer Compatibility

Here is the list of Chart Types and Chart Transforms that you can use while leveraging Calculated Data Series:

Chart Types

1. All Series Charts

2. Pie, Donut, & Funnel Charts

3. Table Charts

Chart Transforms

1. Date Range

2. Filter

3. Compare Dates

4. Sort & Limit

5. Goal Line