Home icon

Define metrics once and keep them correct with the dbt Semantic Layer on Amazon Redshift

Big Data Blog



This article demonstrates how to use the dbt Semantic Layer with MetricFlow on Amazon Redshift to define non-additive metrics like average order value once and compute them correctly across arbitrary dimension combinations at query time.

  • Pre-aggregated gold tables fail for non-additive metrics like average order value when rolled up to different time grains
  • MetricFlow generates correct SQL at query time by recomputing metrics at requested grain instead of averaging pre-aggregates
  • Define metrics once in version-controlled YAML semantic models alongside dbt models
  • Query metrics across any dimension combination without building combinatorial pre-aggregated tables
  • Walkthrough includes seeding sample data, building gold models, defining semantic models and metrics, and querying at different grains
  • Generated SQL shows MetricFlow computing SUM(amount) / COUNT(orders) at requested grain for accuracy

The dbt Semantic Layer on Amazon Redshift eliminates the choice between table sprawl and incorrect metrics by defining governed metrics once and computing them correctly for any dimension and time grain combination.



Go to article

The AWS News Feed is currently looking for gold sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.

Related articles

Oct 15
2026
dbt and Amazon Redshift Data Sharing: Multi-cluster pipelines without moving a byte
Oct 5
2026
Materialize once, query anywhere: Introducing Iceberg materialized views in Amazon Redshift
Aug 13
2025
Build data pipelines with dbt in Amazon Redshift using Amazon MWAA and Cosmos
Oct 5
2026
Run an automated operational review with the Amazon Redshift MCP server

The AWS News Feed is currently looking for silver sponsors. If you want to support the AWS community and reach a large audience of AWS professionals, consider sponsoring the AWS News Feed.