Think about you’re a bar chart of Google Adverts conversions by month in Google Knowledge Studio.

You wish to know the way model campaigns are affecting efficiency.

Bar chart of conversions over timePicture by creator, April 2022

You determine so as to add Campaigns as a “breakdown dimension” so you may see conversions by marketing campaign.

That segmentation doesn’t provide the consequence you’d hoped:

Stacked bar chart with more than 40 campaignsPicture by creator, April 2022

With dozens of campaigns throughout a number of accounts, this chart is way too noisy to be helpful.

So… what now?

You would create a filter for model campaigns.

Nonetheless, that may filter out any non-brand marketing campaign efficiency – which you don’t wish to do.

If it have been supported, importing your labels from Google Adverts would resolve the issue.

How are you going to create your personal segments in Knowledge Studio, so that you’re totally accountable for your visualizations and might drive higher insights?

Reply: CASE.

This CASE assertion enables you to group the branded and non-branded campaigns into two separate segments:

New field screen in Data Studio showing CASE statement grouping campaignsScreenshot taken by creator, April 2022

Utilizing the above code, campaigns that don’t embrace “Model” (or the Dutch language “Merknaam”) will likely be grouped as “NonBrand.”

The ultimate result’s precisely what we hoped for: A stacked bar chart with a breakdown dimension exhibiting conversion totals for less than “Model” and “NonBrand” marketing campaign teams.

Stacked bar chart of brand and nonbrand campaign groups over timePicture by creator, April 2022

The pattern on this chart is obvious: Model conversions have been steadily declining over the yr.

That perception can now drive a method to deal with the problem.

If utilizing CASE to get customized segments in Knowledge Studio has left you annoyed and bewildered, worry not.

This text will present you use CASE with confidence, and provide you with some examples you may apply on to your stories for higher visualizations.

The Case For CASE

It’s laborious to debate CASE expressions with out getting just a little technical, so let’s begin with W3 Faculty‘s definition of a CASE assertion:

The CASE assertion goes via situations and returns a worth when the primary situation is met (like an if-then-else assertion). So, as soon as a situation is true, it is going to cease studying and return the consequence.

If no situations are true, it returns the worth within the ELSE clause. If there isn’t any ELSE half and no situations are true, it returns NULL.

In different phrases, you set the situations in your section (“model campaigns” within the instance above).

If the situation is met (marketing campaign identify incorporates “model”), it’s included within the Model group. If the situation just isn’t met (marketing campaign identify doesn’t comprise “model”), it’s within the NonBrand group.

If that illustration sounds overly simplistic, let’s have a look at a barely extra advanced situation for utilizing CASE from Google Knowledge Studio’s Assist pages:

A standard use for CASE is to create new classes or groupings of knowledge. For instance, to group chosen nation values right into a Gross sales Area dimension, you would possibly create a CASE expression like this:


WHEN Nation IN (“USA”,”Canada”,”Mexico”) THEN “North America”
WHEN Nation IN (“England”,”France”) THEN “Europe”
ELSE “Different”


On this instance, 5 completely different nations are consolidated into two completely different continents, with an “different” class to catch any further nations.

An inventory of dozens and even a whole bunch turns into a clear checklist of three.

The Energy Of Knowledge Studio CASE Expressions

Simplify, make clear and focus busy charts utilizing customized teams and segments.

Compilation of charts and tables before and after using custom fields with case statementsPicture by creator, April 2022

Utilizing CASE expressions, you may:

  • Rebuild the labels utilized in your Google Adverts account.
  • Group Google Adverts campaigns by precedence, focused area, language, or theme.
  • Consolidate or customise default dimensions in your knowledge supply (comparable to swapping Google Analytics default channel grouping with Customized Channel Grouping).
  • Examine the efficiency of 1 key phrase or asset in opposition to a gaggle or class.

After studying some primary syntax and construction, you may create CASE expressions to unravel your particular segmentation and classification challenges.

How To Use CASE Expressions In Knowledge Studio

Searching for the step-by-step directions for utilizing Knowledge Studio CASE expressions? Look no additional.

Right here we’ll overview add a CASE assertion and arrange the formulation.

1. Create A Calculated Area

You’ll discover this feature on the backside proper part of the Knowledge Panel. Click on the blue “Add a Area” button.

Image showing location of Screenshot taken by creator, April 2022

2. Enter And Save The CASE Assertion

Give your area a reputation, then enter the assertion into the formulation field (extra on that under).

Screenshot of Screenshot taken by creator, April 2022

A sound formulation will present a small inexperienced arrow beneath the formulation field.

Then hit “Save” (or “Replace”) and “Accomplished.” Skipping “Save” has the precise consequence you’d anticipate, so don’t overlook to click on each buttons.

3. Add The Area As A Dimension In Your Chart

You’ll discover your new area containing the CASE assertion in your checklist of Obtainable Fields from the Knowledge Panel, and you’ll add it as a dimension in your chart.

Location of dimension field in Data PanelScreenshot taken by creator, April 2022

You may edit the CASE expression any time by clicking on it from the “Obtainable Fields” part of the Knowledge Panel.

How To Write Your CASE Assertion

Now that you know the way so as to add a CASE expression in Knowledge Studio let’s have a look at the syntax you’ll use to construct your formulation.

You’ll use the next elements within the formulation field in your CASE assertion:

  • CASE (opens the formulation).
  • WHEN (describes the situation).
  • THEN (describes the consequence when the situation is met).
  • ELSE (optionally available: describes the consequence when the situation just isn’t met).
  • END (closes the formulation).

As you’ve already seen on this article, there are lots of methods to format a CASE assertion.

Finally, you’ll wish to discover a “widespread denominator” that’s true just for the situation you’re defining with “WHEN.”

Listed below are some examples of how you would arrange the WHEN / THEN formulation:

  • WHEN [field] = “situation” THEN “consequence”
  • WHEN [field] != “situation” THEN “not consequence”
  • WHEN [field] IN (“Worth A”, “Worth B”, “Worth C”) THEN “consequence”
  • WHEN REGEXP_MATCH ([field], “.*situation*”) THEN “consequence”
  • WHEN CONTAINS_TEXT ([field], “situation”) THEN “consequence”

You will get way more superior than this, nevertheless it needs to be sufficient to get you began.

CASE Limitations And Caveats

With the good energy of CASE comes the good accountability of creating certain your knowledge is definitely… correct.

Listed below are some issues to look at for and repair.

Aggregation Errors And Resolution

Your knowledge supply and metric aggregation methodology can result in inaccurate or damaged charts, together with:

  • Non-weighted common of a mean: Averaging a mean distorts precise efficiency metrics.
  • Avg. metric summing: Exhibiting the full of a mean is simply incorrect.
  • Person configuration error: Some knowledge sources will throw a configuration error as an alternative of displaying improper aggregates.
Compilation image of potential errors using CASEPicture by creator, April 2022

Resolution: Don’t mixture pre-calculated fields.

You probably have a metric that’s a calculation (CPC, AOV) relatively than a uncooked complete (Value, Classes), right here’s what to do as an alternative:

Create a brand new calculated area. Enter the formulation, and swap the metric in your chart’s Knowledge Panel together with your new area.

New field screen showing cost / clicks formulaPicture by creator, April 2022

Segmentation Entice (Sign Vs. Noise)

There’s no restrict to how one can slice and cube knowledge, however there’s a restrict on how worthwhile some knowledge segments will likely be.

Correlation just isn’t causation, and figuring out tendencies just isn’t as worthwhile as realizing the trigger.

So whilst you may section your knowledge by Avg CPC ranges, it’s the intent of the key phrase, not the price of the press, that drives post-click efficiency.

Make sure your segments relate to the impact proven in your chart, otherwise you’ll end up optimizing for noise as an alternative of sign.

Different Limitations

CASE has different constraints.

For example:

  • CASE operates in sequential order. If a worth meets the factors for a number of classes, it is going to solely be included within the first one listed within the CASE assertion.
  • You may’t combine dimensions and metrics inside a WHEN situation.
  • You may’t use a formulation inside a WHEN or THEN clause.
  • The CASE area you create is exclusive to the information supply. When you want the identical formulation for a number of knowledge sources, you’ll must create new situations.

You’ll be taught extra about CASE through the use of it, however realizing the restrictions means much less time troubleshooting and looking out assist boards.


CASE statements are a strong solution to group and section your knowledge in Google Knowledge Studio.

It’s not so simple as the drag-and-drop meeting you’re used to. However it’s additionally not out of attain.

Be taught the essential guidelines and syntax, and earlier than it, it’ll change into a go-to software in your visualizations toolbox.

Extra assets:

Featured Picture: Billion Pictures/Shutterstock


Previous article6 Greatest Niches for Affiliate Advertising and marketing in 2022 (Worthwhile and Uncompetitive)
Next articleTips on how to Create a Purchaser Persona for Your Enterprise


Please enter your comment!
Please enter your name here