
In addition, you can use a more complex condition with regular expression matching and logical AND. IF(Actual Sales > Forecast Sales, Bonus * 1.4, Bonus) Then, bonuses will be distributed accordingly. If they do, your new column will the “Bonus” by 1.4, which presumably is going to info you sales team. This simple condition will calculate if “Actual Sales” exceed the “Forecast Sales”.

If we were to use IN, then the list in the CASE function is going to grow substantially and we are more likely to make a mistake while writing it. For example, in the “Complex Campaign” dimension, we have a lot of different and unique campaign iterations. Now, what happens if things get more complicated. How to use REGEXP_MATCH function within CASE? Now if we want to see the campaign simply filtered by the “Language” dimension, we can even exclude “Campaign”. The result is exactly what we were looking for. 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. Then adding IN, which instructs Data Studio that I will be listing text strings. In the statement below, I am opening the CASE with a WHEN, specifying the first condition. The trick with the CASE function is that you often have to find a unique common denominator to parse the data correctly.

This is where you can use the CASE function to write a specific statement. However, you want to see the table below only per “Language”. In the table below, you have a paid digital marketing campaign that includes “EN” and “FR” in the campaign name. 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. Enjoy! What is the Data Studio CASE function? *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. In addition, I have added a section on how to compose the new Simplified CASE statements. 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 this post, we are going to explore one of the most useful functions in Google Data Studio, the CASE.
