How To Unlock Higher Google Information Studio Segments Utilizing “CASE”


Think about you’re taking a look at a bar chart of Google Advertisements conversions by month in Google Information Studio.

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

Bar chart of conversions over timePicture by writer, April 2022

You resolve so as to add Campaigns as a “breakdown dimension” so you possibly can see conversions by marketing campaign.

That segmentation doesn’t provide the end result you’d hoped:

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

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

So… what now?

You could possibly create a filter for model campaigns.

Nevertheless, that can filter out any non-brand marketing campaign efficiency – which you don’t need to do.

If it had been supported, importing your labels from Google Advertisements would resolve the issue.

How are you going to create your individual segments in Information Studio, so that you’re absolutely accountable for your visualizations and may 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 writer, April 2022

Utilizing the above code, campaigns that don’t embody “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 displaying conversion totals for under “Model” and “NonBrand” marketing campaign teams.

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

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

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

If utilizing CASE to get customized segments in Information Studio has left you pissed off and bewildered, concern not.

This text will present you easy methods to use CASE with confidence, and offer you some examples you possibly can apply on to your stories for higher visualizations.

The Case For CASE

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

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

If no situations are true, it returns the worth within the ELSE clause. If there is no such thing as a ELSE half and no situations are true, it returns NULL.

In different phrases, you set the situations to your phase (“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 is just not met (marketing campaign identify doesn’t include “model”), it’s within the NonBrand group.

If that illustration sounds overly simplistic, let’s have a look at a barely extra complicated situation for utilizing CASE from Google Information 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 may 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 totally different international locations are consolidated into two totally different continents, with an “different” class to catch any extra international locations.

An inventory of dozens and even a whole lot turns into a clear listing of three.

The Energy Of Information 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 writer, April 2022

Utilizing CASE expressions, you possibly can:

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

After studying some primary syntax and construction, you possibly can create CASE expressions to resolve your particular segmentation and classification challenges.

How To Use CASE Expressions In Information Studio

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

Right here we’ll overview easy methods to add a CASE assertion and arrange the components.

1. Create A Calculated Subject

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

Image showing location of Screenshot taken by writer, April 2022

2. Enter And Save The CASE Assertion

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

Screenshot of Screenshot taken by writer, April 2022

A legitimate components will present a small inexperienced arrow beneath the components field.

Then hit “Save” (or “Replace”) and “Completed.” Skipping “Save” has the precise end result you’d count on, so don’t neglect to click on each buttons.

3. Add The Subject As A Dimension In Your Chart

You’ll discover your new area containing the CASE assertion in your listing of Accessible Fields from the Information Panel, and you’ll add it as a dimension to your chart.

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

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

How To Write Your CASE Assertion

Now that you understand how so as to add a CASE expression in Information Studio let’s have a look at the syntax you’ll use to construct your components.

You’ll use the next parts within the components field to your CASE assertion:

  • CASE (opens the components).
  • WHEN (describes the situation).
  • THEN (describes the end result when the situation is met).
  • ELSE (elective: describes the end result when the situation is just not met).
  • END (closes the components).

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

Finally, you’ll need 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 possibly can arrange the WHEN / THEN components:

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

You may get rather 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 duty of creating positive your information is definitely… correct.

Listed below are some issues to observe for and repair.

Aggregation Errors And Resolution

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

  • Non-weighted common of a median: Averaging a median distorts precise efficiency metrics.
  • Avg. metric summing: Exhibiting the entire of a median is simply improper.
  • Person configuration error: Some information sources will throw a configuration error as a substitute of displaying improper aggregates.
Compilation image of potential errors using CASEPicture by writer, April 2022

Resolution: Don’t mixture pre-calculated fields.

In case you have a metric that’s a calculation (CPC, AOV) quite than a uncooked whole (Value, Periods), right here’s what to do as a substitute:

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

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

Segmentation Entice (Sign Vs. Noise)

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

Correlation is just not causation, and figuring out tendencies is just not as helpful as figuring out the trigger.

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

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

Different Limitations

CASE has different constraints.

For example:

  • CASE operates in sequential order. If a price meets the factors for a number of classes, it would 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 components inside a WHEN or THEN clause.
  • The CASE area you create is exclusive to the info supply. In case you want the identical components for a number of information sources, you’ll must create new cases.

You’ll study extra about CASE through the use of it, however figuring out the constraints means much less time troubleshooting and looking out assist boards.


CASE statements are a strong method to group and phase your information in Google Information Studio.

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

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

Extra assets:

Featured Picture: Billion Photographs/Shutterstock


Please enter your comment!
Please enter your name here