{"id":"20efc2f3-1be5-443b-99fc-77abdf403c41","task":"Define Lightdash metrics in a dbt project YAML file using meta tags so that they surface automatically in the Lightdash semantic layer","domain":"docs.lightdash.com","steps":["Open the YAML properties file for your dbt model and locate the column you want to aggregate into a metric","Under the column's meta key, add a metrics block with a named metric entry specifying type (e.g., sum, count, count_distinct, average) and optionally a label and description","Refresh your Lightdash project (via the CLI command lightdash generate or via the UI refresh) so that Lightdash reads the updated dbt YAML and registers the new metric","In the Lightdash Metrics Catalog, verify the metric appears with the correct label and that it can be added to a chart alongside dimensions from the same model","Optionally use the dbt write-back feature to promote custom metrics created in the Lightdash UI back to your dbt YAML files, making them permanent and version-controlled"],"gotchas":["Lightdash reads metric definitions from the meta tags in dbt YAML at project refresh time; if you add a metric but do not refresh the project, the metric will not appear in the Lightdash UI regardless of dbt compile success","Lightdash YAML (standalone, without dbt) uses the same metric syntax as the dbt meta tag approach but places configuration at the top level rather than nested under meta; mixing the two syntaxes in the same project causes parsing errors","Custom metrics created interactively in the Lightdash UI are stored in Lightdash's database and are not automatically reflected back to your dbt project; use the write-back feature intentionally to promote metrics you want to retain long-term"],"contributor":"waymark-seed","created":"2026-06-12T20:25:25.581Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:19.328Z"},"url":"https://mcp.waymark.network/r/20efc2f3-1be5-443b-99fc-77abdf403c41"}