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

How To Unlock Better Google Data Studio Segments Using “CASE”

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

You wish to understand how 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 outcome 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 possibly can create a filter for model campaigns.

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

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

How are you going to create your individual segments in Information Studio, so that you’re totally in charge of 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 creator, April 2022

Utilizing the above code, campaigns that don’t embody “Model” (or the Dutch language “Merknaam”) shall 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 less than “Model” and “NonBrand” marketing campaign teams.

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

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

That perception can now drive a method to handle the difficulty.

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

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

The Case For CASE

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

The CASE assertion goes by means of circumstances 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 can cease studying and return the outcome.

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

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

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

If that illustration sounds overly simplistic, let’s take a look at a barely more complex scenario for using CASE from Google Information Studio’s Assist pages:

A typical 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 further international locations.

An inventory of dozens and even a whole bunch turns into a clear checklist 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 creator, April 2022

Utilizing CASE expressions, you may:

  • 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 (akin to swapping Google Analytics default channel grouping with Custom Channel Grouping).
  • Examine the efficiency of 1 key phrase or asset towards a gaggle or class.

After studying some fundamental syntax and construction, you may 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 assessment how one can add a CASE assertion and arrange the system.

1. Create A Calculated Area

You’ll discover this selection on the backside proper part of the Information 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 system field (extra on that under).

Screenshot of Screenshot taken by creator, April 2022

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

Then hit “Save” (or “Replace”) and “Accomplished.” Skipping “Save” has the precise outcome you’d anticipate, so don’t neglect 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 Out there Fields from the Information Panel, and you may 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 “Out there 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 take a look at the syntax you’ll use to construct your system.

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

  • CASE (opens the system).
  • WHEN (describes the situation).
  • THEN (describes the outcome when the situation is met).
  • ELSE (optionally available: describes the outcome when the situation is just not met).
  • END (closes the system).

As you’ve already seen on this article, there are various 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 possibly can arrange the WHEN / THEN system:

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

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

CASE Limitations And Caveats

With the nice energy of CASE comes the nice accountability 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 mean: Averaging an average distorts precise efficiency metrics.
  • Avg. metric summing: Exhibiting the whole of a mean is simply unsuitable.
  • 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 creator, April 2022

Resolution: Don’t combination pre-calculated fields.

You probably have a metric that’s a calculation (CPC, AOV) somewhat than a uncooked whole (Value, Classes), right here’s what to do as a substitute:

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

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

Segmentation Lure (Sign Vs. Noise)

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

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

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

Be 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.

As an example:

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

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


CASE statements are a strong strategy 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. However it’s additionally not out of attain.

Be taught the fundamental guidelines and syntax, and earlier than you already know it, it’ll turn into a go-to software in your visualizations toolbox.

Extra sources:

Featured Picture: Billion Images/Shutterstock

Source link

Leave A Comment



Our purpose is to build solutions that remove barriers preventing people from doing their best work.

Giza – 6Th Of October
(Sunday- Thursday)
(10am - 06 pm)

No products in the cart.

Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
  • Attributes
  • Custom attributes
  • Custom fields
Click outside to hide the compare bar