Skip to main content
Skip table of contents

Categorizations

tegorizations are a way to categorize elements of your data. You can then use the categorizations inside of your SQL. This gives your team an easy way to keep all of your categorizations in one place and outside of raw SQL.

You can find categorizations for your clients by clicking the Categorizations in the top nav bar.

Creating Categorizations

  1. Required Dimensions & Metrics - Fields that your function will use. Adding a required dimension makes it available in the "IF" part of the query.

  2. Rule - A rule contains a Field, Operator, Value and Answer.

  3. Default Value - If none of the values match, a default value is then applied.

Using Categorizations inside of Redshift

Categorizations inside of redshift are very easy to use and do not rely on datasources. They are created as functions.

For instance, the following categorization named channel inside of the playground client:

would be a reference in SQL as:

CODE
select playground.channel(campaignName) from pmg.datasource;

The field name does not have to match the UI. Since the categorizations are not datasource dependent, you can use any datasource column.

CODE
select playground.channel(campaign_name) from pmg.datasource2;
select playground.channel(campaignName) as channel, SUM(impressions) from playground.adwords_datasource GROUP BY channel;  

Using Categorizations inside of BigQuery

BigQuery categorizations very similar to Redshift

CODE
select playground.channel(campaign_name) from playground.datasource

Bulk Upload

  1. Make a new categorization and then get a clean categorization template by clicking on the Download Template button.

  2. You should get a CSV template with a header:

    1. DIM_METRIC_NAME - The dimension or metric name

    2. OPERATOR - the function you want to apply to your current value with a value you want to compare to

    3. VALUE - the comparing value that will go against the values from reports

    4. THEN - the resulting value; skip if this is an and statement

    5. AND - fill in and in the excel cell if using an and statement

  3. To upload the bulk sheet, just drag/drop the file onto the RULES area.

Bulk Sheet Example

I have a bulk upload file that will look at campaign names in a report and give a new value where the campaign name is active on.

If the names louisiana AND texas, then I want to have a value south in a new column.

Publishing a Categorization

To publish a categorization, hit the Publish button. It will then be available to use in SQL.

Advanced Delimiters

When using delimiters, you can specify the values in fields, categorization values and default values. 

To setup a categorization, select the field next to the category field:

You can then use the categorization or default values with a colon(:) plus a number (starting with 0).

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.