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

DevFeed: [Define metrics once and keep them correct with the dbt Semantic Layer on Amazon Redshift](<https://devfeed.tech/articles/define-metrics-once-and-keep-them-correct-with-the-dbt-semantic-layer-on-amazon-redshift-126346.md>)

Original publisher: [Read original article](<https://aws.amazon.com/blogs/big-data/define-metrics-once-and-keep-them-correct-with-the-dbt-semantic-layer-on-amazon-redshift/>)

Author: Isabelly Rocha

Published: 2026-11-09T20:17:13Z

Content type: tutorial

Language: en

Sources: [AWS Big Data Blog](<https://devfeed.tech/sources/aws-big-data-blog.md>)

Topics: [semantic-layer](<https://devfeed.tech/topics/semantic-layer.md>)

Tags: [advanced-300](<https://devfeed.tech/tags/advanced-300.md>), [amazon-redshift](<https://devfeed.tech/tags/amazon-redshift.md>), [dbt](<https://devfeed.tech/tags/dbt.md>), [dbt-semantic-layer](<https://devfeed.tech/tags/dbt-semantic-layer.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [metrics](<https://devfeed.tech/tags/metrics.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [technical-how-to](<https://devfeed.tech/tags/technical-how-to.md>), [weekly](<https://devfeed.tech/tags/weekly.md>)

## AI overview

A pre-aggregated daily gold table can give a plausible but wrong weekly average order value: averaging its daily values yields $550, while recomputing total revenue divided by order count at the week grain yields $280. The walkthrough defines that ratio once in version-controlled dbt YAML and uses the open-source dbt Semantic Layer, powered by MetricFlow, to generate grain-aware SQL on Amazon Redshift for different dimensions without prebuilding a table for every combination. It presents the gold layer as a sensible low-cost default for stable, additive metrics, with a query-time semantic layer useful when users need arbitrary slices or non-additive metrics. The `mf` CLI supports querying and exporting generated SQL; BI tools that consume the semantic manifest can query governed metrics, while Quick Sight can read a materialized Redshift table. The hosted Semantic Layer API requires dbt Cloud; the metric definitions remain the same.

## Source excerpt

Amazon Redshift has no native semantic layer, yet teams still need consistent, governed metric definitions across BI tools. This post shows how to define a metric once with the open-source dbt Semantic Layer (MetricFlow) on Amazon Redshift so it stays correct at any grain, and proves a non-additive weekly average comes out right ($280, not $550).