How to Group Data in Looker Studio

Cody Schneider

Grouping data in Looker Studio is a powerful way to transform a messy, detailed chart into a clean, insightful story. If you’ve ever had a report with dozens of social media referral sources or a long list of campaign names, you know how hard it can be to spot the bigger trends. This guide will walk you through exactly how to group that data using calculated fields, turning your raw numbers into actionable reports your team can actually understand.

Why Group Data in Looker Studio?

Before jumping into the “how,” it’s helpful to understand the “why.” Grouping isn’t just about making things look tidier, it serves a strategic purpose in your reporting. By consolidating detailed entries into broader categories, you can uncover patterns that were previously hidden in the noise.

Here are a few common scenarios where grouping is incredibly useful:

  • Cleaning Up Marketing Channels: Your Google Analytics data might show referrals from facebook.com, m.facebook.com, l.facebook.com, and t.co. Instead of seeing these as separate sources, you can group them all under a single “Organic Social” channel. This gives you a clear view of social media's overall impact without getting bogged down in platform-specific subdomains.

  • Categorizing Content: Imagine you want to see how your blog content performs against your product pages. Instead of analyzing hundreds of individual URLs, you can create groups like "Blog Posts," "Product Pages," and "Homepage." This helps you understand which types of content are driving traffic and conversions.

  • Segmenting Campaigns: Let’s say your team runs campaigns with naming conventions like "Summer_Sale_2024_Email" and "Summer_Sale_2024_Facebook." You can group all campaigns containing "Summer_Sale_2024" into a "Summer Sale 2024" category. This allows you to evaluate the performance of the entire initiative at a glance.

Ultimately, grouping shifts the focus from granular data points to the bigger picture. It allows you to tell a clearer story, making it easier for stakeholders to grasp key takeaways and make better decisions.

The Best Way to Group Data: The CASE Statement

Looker Studio (and Google Data Studio before it) doesn’t have a simple "right-click and group" feature like you might find in a pivot table. Instead, the most flexible and powerful way to group dimensions is by creating a calculated field using a CASE statement.

A CASE statement might sound intimidating if you're not used to writing formulas, but its logic is very straightforward. It simply tells Looker Studio to check for a series of conditions and then return a specific value (your group name) when a condition is met.

Here’s the basic structure:

Let's break that down:

  • CASE and END: These are the bookends of your formula. You always start with CASE and finish with END.

  • WHEN: This is where you define your condition. For example, "when the dimension Source / Medium contains 'facebook'".

  • THEN: This defines the new group name to assign if the WHEN condition is true. For example, "then call it 'Organic Social'".

  • ELSE: This is an optional but highly recommended catch-all. It tells Looker Studio what to call anything that doesn’t meet any of your WHEN conditions. Without it, unmatched items may show up as null, which can skew your reports.

Think of it as setting up a series of rules for a sorting machine. The CASE statement looks at each row of data, checks it against your rules from top to bottom, and assigns it to the first bucket it fits into.

Step-by-Step Guide: How to Create a Custom Channel Grouping

Theory is great, but let's walk through a real-world example. We'll create a custom channel grouping to combine various traffic sources from Google Analytics into clean, high-level categories like "Paid Search," "Organic Social," "Direct," and "Email."

Step 1: Open Your Report and Select a Chart

Start by navigating to your Looker Studio report. You can either add a new chart or work on an existing one you want to improve. For this example, let’s use a simple table that is currently showing Session source / medium as its dimension and Users as its metric.

Right now, your chart probably looks something like this - a long, messy list:

  • google / organic

  • (direct) / (none)

  • bing / cpc

  • facebook.com / referral

  • newsletter / email

  • google / cpc

Step 2: Add a New Calculated Field

In the Data panel on the right side of the screen, scroll down to the bottom of your dimensions and click the Add a field button. It will open the calculated field editor.

Step 3: Name Your Field and Write Your CASE Statement

First, give your new field a clear name. Something like “Custom Channel Grouping” is a good choice.

Now, let's write the formula in the Formula box. We’re going to use a function called REGEXP_MATCH within our CASE statement. This function allows us to use more flexible matching patterns, making our formula shorter and more powerful.

Here is a formula you can adapt. Copy and paste it into the editor:

What this formula is doing:

  • It looks at the Session source / medium for each row.

  • If it contains "cpc" or "ppc," it groups it as "Paid Search."

  • If it includes words like "social," "facebook," or "twitter," it becomes "Organic Social."

  • The ELSE statement ensures any source that doesn’t match our rules is bucketed into "Other," so no data gets lost.

Once you are done, click Save and then Finish.

Step 4: Use Your New Dimension

Your new calculated field, "Custom Channel Grouping," will now appear in your list of available dimensions. Drag it into the Dimension section of your chart setup and remove the old Session source / medium dimension.

Immediately, your cluttered table will transform into a clean, easy-to-read summary of your marketing channels. The long list of individual sources is now neatly summarized, showing you exactly where your users are coming from at a high level.

Practical Tips for Better Grouping

Once you've mastered the basic CASE statement, you can refine your approach with a few additional tricks.

1. Use CONTAINS_TEXT for Simpler Matching

If REGEXP_MATCH feels a bit too technical, you can use the simpler CONTAINS_TEXT function for many scenarios. It's less flexible but easier to write and read. For example, grouping blog pages:

2. Standardize Your Data for Accurate Matching

Data isn't always clean. Sometimes you’ll have a mix of "Facebook," "facebook," and "FACEBOOK." CASE statements are case-sensitive by default, which can cause them to miss variations. To avoid this, use a function like UPPER or LOWER to standardize the text before checking it.

Here's how you'd modify the formula to avoid case-sensitivity issues:

This formula converts the entire Campaign name to lowercase before checking if it contains "summer sale," so it will match "Summer Sale," "summer sale," and "SUMMER SALE" all at once.

3. Combine Conditions with AND / OR

For more specific groupings, you can use AND or OR to combine multiple conditions in a single WHEN line. Let's say you want to identify users from Google who are also on mobile.

4. Don't Neglect the ELSE Statement

It's worth repeating: always include an ELSE statement. Without it, any data that doesn't fit a WHEN condition will be uncategorized (null) and either won't appear in your charts or will skew your percentages. An "Other" bucket helps you see if your current rules are missing anything important, allowing you to refine your CASE statement over time.

Final Thoughts

Mastering the CASE statement is one of the most practical skills you can develop in Looker Studio. It allows you to move beyond basic reporting and create truly insightful dashboards that tell a clear, concise story. By grouping your data thoughtfully, you can reduce clutter, highlight meaningful trends, and empower your team to make smarter, data-driven decisions.

While building custom CASE statements is a fantastic way to handle your reporting, it also highlights the manual work of traditional BI tools. We built Graphed to remove this friction entirely. Instead of writing formulas, you connect your data sources (like Google Analytics, Salesforce, and your ad platforms) and simply ask for the dashboard you need in plain English. We handle a lot of this grouping and analysis automatically, turning hours of configuration into a 30-second task.