NorthStar Analytics
Pricing

HiDocs High-Quality Ghost Documentation Theme

How to Create CASE Statements in Google Data Studio?

How to Create CASE Statements in Google Data Studio?

Have you been struggling with creating case statements in Google Data Studio?

Using IF statements in Google Data Studio can get messy, and if you don't know how to create CASE statements in Google Data Studio, you're left with a lot of formula errors.

This post will demonstrate how to resolve the situation.


How to create CASE statements?

CASE statements are boolean values, and they return the value you specify.

CASE is often used to establish new data categories or groups. In order to organize nation data into a Sales Region dimension, for example, you might build a CASE statement that looks something like this:

  1. From right setting pane, click on Add Metric
  2. From the opened menu, click on Create Field
  3. Type in the CASE statement. You will see a green check if arguments works.

These steps can be also done from Resource → Manage added data sources → click on desired data source screen.


CASE Statement Explained

There is a CASE keyword at the beginning of the expression and a Conclusion keyword at the end. Sections or "clauses" are used to break up the paragraphs.

  • WHEN: a condition you want to evaluate. In a single CASE statement, you may include numerous WHEN clauses.
  • THEN: If the condition in the WHEN clause is met, the THEN clause returns the result. In your CASE expression, you must have one THEN clause for every WHEN clause in the expression.
  • ELSE. This is optional. Whenever none of the WHEN clause conditions are met, CASE returns the value indicated in the ELSE clause, or NULL if no ELSE clause has been explicitly stated.

If the condition is true, CASE examines each subsequent WHEN clause and returns the first result that is returned. Any leftover WHEN clauses as well as the ELSE outcome are not taken into consideration. Because CASE returns NULL if all WHEN conditions are false or NULL, it returns the result specified by the Else statement, or NULL if no ELSE clause is specified by the statement.

There can be only one sort of outcome in a THEN clause. So if the first THEN clause returns text, then all subsequent THEN clauses and the ELSE clause must return text, too.

Make your business data transparent!
  • Subscribe to a package

    Subscribe and explore the limits of your business with data or thinking to expand your agency value proposition with Google Data Studio dashboards?

  • Request unlimited dashboards

    You can request as many dashbaords you might have and as many revisions as you might need. We create a queue of your tasks, the first tasks that come in are the tasks that we’ll deliver first.

  • Your Data Studio Department

    Optimise your business with complete transparency through dashboards or provide value-added Google Data Studio service to your agency clients.

Make your business transparent

The fastest easy-to-use Google Data Studio dashboards without any recurring cost.