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 transformation before the sumup instruction.

Creating a custom script transformation using the sumup instruction

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

  1. Create a custom script transformation.

  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 transformation 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 transformation and optionally as the output.

Example

Transformation configuration

Input Field

Clicks

Output Field

Sum of Clicks

Discriminators

Campaign

Ad Group

Data table before transformation

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 transformation

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