sumup

Add a column containing a running total to your data extract.

This guide explains how to configure the sumup instruction. To learn about another instruction, go back to the Available custom script instructions overview.

Introduction

Use the sumup instruction to add a new column to the data extract that contains a running total of a selected column. You can add in discriminators to reset the running total if a certain value is found.

To use the sumup custom script instruction, the values used in the instruction must be in numeric format. If necessary, use the convertnumbers custom script instruction to convert string values to a numeric format. Add the convertnumbers instruction to the same custom script enrichment before the sumup instruction.

Creating a custom script enrichment using the sumup instruction

To create and configure a custom script using the sumup instruction, follow these steps:

  1. Create a custom script enrichment.

  2. In the Instructions step, select the sumup instruction.

  3. To configure the custom script instruction, fill in the following fields. Required fields are marked with an asterisk (*).

Input Field

Enter the name of the column that contains the values to sum up. This column must contain numerical values.

Output Field

Enter a name for the new column to add to the data extract. This column will contain the running total values.

Discriminators

Enter the names of the columns that contain the distinct values that reset the count. See the example below.

Subtable

Enter the name for a subtable that you want to use within this custom script.

A subtable is a temporary table that only exists for this custom script. You can apply additional instructions within the same custom script to the subtable. However, the subtable cannot be used in any other custom scripts.

If a subtable does not exist for the current custom script, the enrichment is applied to the data extract, and the enriched data is output into the subtable. If the subtable already exists for the custom script, the subtable is used as the input for the enrichment and optionally as the output.

Example

Enrichment configuration

Input Field

Clicks

Output Field

Sum of Clicks

Discriminators

Campaign

Ad Group

Data table before enrichment

Campaign

Ad Group

Clicks

Brand

ecommerce

7

Brand

ecommerce

3

Dashboard

ecommerce

18

Brand

ecommerce

4

Dashboard

media

5

Dashboard

media

11

Data table after enrichment

Campaign

Ad Group

Clicks

Sum of Clicks

Brand

ecommerce

7

7

Brand

ecommerce

3

10

Dashboard

ecommerce

18

18

Brand

ecommerce

4

22

Dashboard

media

5

5

Dashboard

media

11

16