distinct

Find the number of distinct rows in a data extract.

Introduction

Use the distinct enrichment to find the distinct rows in a data extract, and to return how many times the rows appear in the data extract.

To find only duplicate values, use the duplicates enrichment.

To find distinct rows and aggregate the metric values, use the aggregate enrichment.

Creating the enrichment

For more information on creating an enrichment, see Using custom scripts.

Configuring the enrichment

To configure the enrichment, fill in the following fields. Required fields are marked with an asterisk (*).

Key

Enter the names of the columns to be used when checking for distinct rows. Click to add columns.

Count

Enter the name of the column that is to be added to the data extract. This column displays the number of distinct rows for each unique combination of values found in the columns specified in Keys.

Presorted

Select this checkbox if the included data extracts are presorted.

Subtable

Enter the name for a subtable that you want to contain the enriched data. The enrichment is applied to the whole data extract, then the enriched data is output into the subtable you have named here.

This subtable is a temporary table, which means it 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.

Example

Enrichment configuration

Key*

Ad Group

Region

Count

Entry Count

Data table before enrichment

Ad Group

Region

Clicks

media

UK

3493

media

UK

8891

media

UK

2782

ecommerce

France

7397

ecommerce

Germany

6397

social

USA

5645

social

USA

1946

social

Spain

3356

Data table after enrichment

Ad Group

Region

Clicks

Entry Count

media

UK

3493

3

ecommerce

France

7397

1

ecommerce

Germany

6397

1

social

USA

5645

2

social

Spain

3356

1