In this post, we are going to explore one of the most useful functions in Google Data Studio, the CASE. I personally think that knowing how to write a

How to use CASE statements in Google Data Studio? – 2021

submited by
Style Pass
2021-07-21 18:00:07

In this post, we are going to explore one of the most useful functions in Google Data Studio, the CASE. I personally think that knowing how to write a CASE is not only helpful in Data Studio, but also it allows you to understand how computer logic works. In addition, I have added a section on how to compose the new Simplified CASE statements.

*NEW – By popular demand, I have decided to expand the comprehensive guide on CASE and added IF statements, as the Google Data Studio team has had some incredible updates over the past year. Enjoy!

The CASE function returns dimensions and metrics based on conditional expressions; it is often used to create new groupings of data and sort them in categories. Let’s imagine the following scenario. In the table below, you have a paid digital marketing campaign that includes “EN” and “FR” in the campaign name. However, you want to see the table below only per “Language”. This is where you can use the CASE function to write a specific statement.

The trick with the CASE function is that you often have to find a unique common denominator to parse the data correctly. In the statement below, I am opening the CASE with a WHEN, specifying the first condition. Then adding IN, which instructs Data Studio that I will be listing text strings. Finally, I go ahead and choose my campaign name(s) and specify with THEN what I want to name the result of my WHEN condition. I know…. this is a bit of a tongue twister.

Leave a Comment