What is a Dimension Group in Looker?

Cody Schneider8 min read

Working with dates and times in data analysis can feel tedious. Your database probably stores time as a very specific timestamp, like "2023-11-20 09:30:15", but you need to see trends by month, week, or quarter. That's where Looker's dimension_group comes in - it’s a simple yet powerful LookML command designed specifically to make time-based analysis easy and efficient. This article will walk you through exactly what a dimension group is, why it's so useful, and how to set one up step-by-step.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Why Is Time-Based Analysis So Important?

Almost every business question involves time. You want to know if sales are growing month-over-month, if marketing campaigns are driving more weekly signups, or how website traffic today compares to the same day last year. Analyzing data across different timeframes is fundamental to spotting trends, understanding performance, and making informed decisions.

The problem is that raw data isn't set up for this kind of analysis. A timestamp like created_at in your orders table tells you the exact second an order was placed, but it doesn't automatically group that order into "November" or "Q4". To get meaningful insights, you need to aggregate these individual moments into larger buckets: days, weeks, months, and so on.

The Old Way vs. The Looker Way with Dimension Groups

Before dimension_group, you had to manually create a separate dimension for every single timeframe you wanted to analyze. This meant writing repetitive SQL or LookML, which was not only slow but also created clutter and potential for errors.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

The Manual, Repetitive Method (Without dimension_group)

Imagine you have a timestamp column called created_at. If you wanted to analyze a dataset by day, week, month, and year, you would have to define four separate dimensions in your LookML view file. The code would look something like this:

The OLD, clunky way to handle timeframes

dimension: created_date { type: date sql: CAST(${TABLE}.created_at AS DATE) ,, }

dimension: created_week { type: string sql: FORMAT_DATE("%Y-%W", ${TABLE}.created_at) ,, }

dimension: created_month { type: string sql: FORMAT_DATE("%Y-%m", ${TABLE}.created_at) ,, }

dimension: created_year { type: number sql: EXTRACT(YEAR FROM ${TABLE}.created_at) ,, }

As you can see, this is a lot of repeated code. It works, but it’s inefficient and makes your LookML harder to read and maintain. For every new timestamp field you wanted to analyze (like updated_at or shipped_at), you'd have to write this whole block of code all over again.

The Efficient, Clean Method (with dimension_group)

The dimension_group parameter consolidates all that work into one clean, simple block of code. Instead of four separate dimensions, you’d write just this:

The NEW, clean way with dimension_group

dimension_group: created { type: time timeframes: [ date, week, month, year ] sql: ${TABLE}.created_at ,, }

That’s it. In the background, Looker takes this single block and automatically creates all the necessary time-based dimensions for you: Created Date, Created Week, Created Month, and Created Year. Your code is now cleaner, easier to understand, and much faster to write.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

How to Create a Dimension Group: A Step-by-Step Guide

Ready to build your first dimension group? The process is straightforward. Here’s how you can do it in your LookML project.

Step 1: Identify Your Timestamp Column

First, pinpoint the column in your database table that contains date or time information. These columns typically have names like order_date, signup_at, or event_timestamp. This is the column your dimension group will be based on.

Step 2: Open the Correct View File in Looker

Navigate to your project files in Looker’s development mode. Dimension groups are defined within a view file, which corresponds to a table in your database. For instance, if you’re analyzing order dates, you'll need to open the orders.view.lkml file.

Step 3: Write Your LookML Code

Now, write the dimension_group LookML. Let’s create one to analyze data from a column named order_placed_at. The code looks like this:

view: orders {

... other dimensions and measures

dimension_group: placed { label: "Order Placed" # Cleans up the name in the user interface type: time # Required. Use 'time' for timestamps. timeframes: [ # A list of all the time cuts you want. raw, time, date, week, month, quarter, year ] sql: ${TABLE}.order_placed_at ,, # Points to the timestamp column in your database. }

... more LookML

}

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Step 4: Understand the Parameters

Let's break down what each part of that code block does:

  • dimension_group: placed: This line starts the definition. We’ve named our group "placed," but you can name it anything descriptive (e.g., "signup," "completed," "shipped").
  • label: "Order Placed": This is an optional but highly recommended parameter. It creates a neat, dropdown-style grouping in the Explore interface called "Order Placed." All the timeframes you define (like Date, Week, Month) will live inside it, keeping your field list clean and organized for business users.
  • type: time: This tells Looker what kind of data the group handles. For date and time analysis, you'll almost always use type: time. Looker also offers a type: duration for calculating the time between two dates, but type: time is the one you’ll use most often.
  • timeframes: [ ... ]: This is where the magic happens. Here, you provide a list of the specific date and time granularities you want Looker to generate automatically. Common options include:
  • sql: ${TABLE}.order_placed_at ,,: This is the most crucial part. It points the dimension group to the actual timestamp column in your database. The ${TABLE} variable dynamically refers to the SQL table associated with the view file you’re in. Always make sure this points to a column with a date or timestamp data type.

Once you save your changes and push them to production, business users will find a new "Order Placed" field group in their Explore. They can then expand it and choose whichever timeframe they need for their analysis, like pulling Order Placed Month and a Total Sales measure to build a monthly sales report.

Practical Examples in Different Business Contexts

Dimension groups are useful across all departments. Here are a few common scenarios:

  • E-commerce Manager: By creating a dimension group on the orders.created_at column, you can easily create tiles on a dashboard showing "Revenue by Month," "Average Order Value by Week," and "Top Selling Products this Quarter."
  • Marketing Analyst: A dimension group on the users.signup_at field allows you to track marketing performance. You can quickly filter reports to see "New Users This Week" or build charts that visualize "User Growth Per Quarter" to understand long-term acquisition trends.
  • Sales Operations Lead: By adding a dimension group for the deals.closed_at field in your CRM data, you can build a sales performance dashboard that measures "Deals Won Per Month by Sales Rep" and "Sales Pipeline Value by Quarter."

Advanced Tips and Considerations

Once you’ve mastered the basics, you can enhance your dimension groups with additional functionality.

  • Changing the Start of the Week: By default, Looker considers Sunday the first day of the week. Many businesses, however, prefer to start their weeks on Monday. You can set this globally by adding week_start_day: monday to your project's model file.
  • Managing Timezones: Timestamps can get complicated when your business operates across different timezones. The convert_tz parameter with a dimension group can specify whether or not Looker should convert the timezone for a user. Set it to no for timestamps that should remain fixed regardless of who is viewing the data.
  • Unlocking Powerful Filtering: The dimensions created by a dimension group are perfect for filtering Explores and dashboards. Business users can easily create dynamic reports like "Last 90 Days," "This Quarter," or "In the past 4 weeks" with a few clicks, making their data exploration far more intuitive.

Final Thoughts

Looker's dimension_group is a deceptively simple feature that provides enormous value. It transforms the clunky, repetitive task of preparing time-based data for analysis into a clean, single step, saving developers time and reducing the complexity of LookML code. More importantly, it empowers business users to slice and dice data across any timeframe they need with ease.

While LookML features like this make BI tools more manageable, many teams still find the setup and maintenance of platforms like Looker too complex for their core needs. Sometimes, what you need is a quick, direct answer about what your data means without waiting for a data team or learning a new coding language. That's precisely why we built our tool, Graphed. We connect directly to your marketing and sales data sources - like Shopify, Google Analytics, Salesforce and more - and let you create reports and dashboards simply by asking questions in plain English, helping you find actionable insights in seconds.

Related Articles