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

What are Measures?

Measures are aggregated computations performed on specific columns within your model. They are used to derive insightful metrics, often serving as the foundation for more complex analytical structures. Measures can range from simple sums or averages to intricate calculations utilizing various dimensions, conditions, and data transformations.

How to Define Measures

When defining a measure, there are several parameters you need to be acquainted with:

Name

A unique identifier for the measure across all semantic models in your project.

Description

A human-readable explanation of the calculated measure.

Aggregator

Determines the type of aggregation applied, such as sum, average, max, etc.

Expression (expr)

Either references an existing column or provides a SQL expression for a new or derived column.

How to create and edit a measure

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

Specification for Measures

Measures are articulated using the following structure:

measures:
  - name: [Measure Name]
    description: [Description]
    agg: [Aggregation Type]
    expr: [SQL Expression or Column Name]
    agg_params: [Aggregation Specific Properties]
    agg_time_dimension: [Time Dimension]
    non_additive_dimension: [Dimensions that shouldn't be aggregated]
    label: [Label for the measure]

For example, consider a semantic model detailing transactions:

Copy code
semantic_models:
  - name: transactions
    description: A record of all transactions. Multiple transactions are recorded per SKU for carts.
    model: {{ ref("fact_transactions") }}
  measures:
    - name: transaction_amount_usd
      description: Total USD value of transactions
      expr: transaction_amount_usd
      agg: sum
      label: Transaction Amount (USD)
    - name: average_transaction
      description: Average USD value of transactions per day
      expr: transaction_amount_usd
      agg: average
      label: Average Daily Transaction

Supported Aggregations

We support a rich set of aggregation types to cater to various data analysis needs:

Basic aggregations provide elementary mathematical operations on data.

  • sum: Total of values.
  • min: Smallest value.
  • max: Largest value.
  • average: Mean of values.

When constructing measures, it’s crucial to ensure the data types and SQL functions align with your specific data platform’s capabilities. Differences may exist across platforms.

Wrapping Up

Measures play a central role in deriving insights from your data with metrics. By understanding and utilizing measures effectively, you’ll be equipped to derive more valuable and accurate metrics for your analytical endeavors.