To connect to a database other than Google Analytics you will need an enterprise plan.
Contact sales

What are Dimensions?

Dimensions offer a way to group or filter data based on categories or timeframes. Think of them as special labels that simplify data organization and analysis. In the realm of data platforms, they form a part of the larger structure known as a semantic model, created alongside identifiers and measures.

In SQL, dimensions typically align with the group by clause of your SQL query.

How to Define Dimensions

Every dimension necessitates a name, a type, and sometimes, an expression parameter. Below is a breakdown of these parameters:

Name

The visible name of the dimension. It can also act as an alias if there’s a discrepancy between the column name or SQL query reference and what’s provided in the expression.

Type

This determines the kind of group in the semantic model. The types are: Categorical and Time.

Time granularity

Time dimensions are used to group metrics by different levels of time, such as day, week, month, quarter, and year.

Description (optional)

Provides a detailed explanation of the dimension.

Expression (optional)

Indicates the underlying column or SQL query for the dimension. By default, we will use the column name if expr isn’t provided.

How to create and edit a dimension

In the Catalog section click click on a table you want to set up a dimension for. Then click on the Dimensions tab.

Specification for Dimensions

Dimensions are logically defined using the following parameters:

dimensions:
  - name: [name]
    type: [Categorical or Time]
    type_params: [specific type parameters]
    description: [description]
    expr:
      [
        column name or expression. If not provided,
        the default is the dimension name,
      ]

For instance, consider a semantic model detailing transactions:

semantic_models:
  - name: transactions
    description: A record of every transaction. Carts are grouped as multiple transactions per SKU.
    model: {{ ref("fact_transactions") }}
    defaults:
      agg_time_dimension: metric_time
  dimensions:
    - name: metric_time
      type: time
      expr: date_trunc('day', ts)
    - name: is_bulk_transaction
      type: categorical
      expr: case when quantity > 10 then true else false end
To identify and process dimensions, it's essential that each dimension associates with a primary identifier.

Types of Dimensions

We supports two primary types of dimensions: Categorical and Time.

Categorical dimensions facilitate grouping metrics by categories, like product type or geographical region. They can reference existing columns or be derived from SQL expressions.

Example:

dimensions:
  - name: is_bulk_transaction
    type: categorical
    expr: case when quantity > 10 then true else false end
Time Dimensions

Wrapping Up

Dimensions play a pivotal role in organizing, filtering, and analyzing your data. By mastering the use of dimensions, you can create more meaningful and insightful data models.