{"id":"4c114e48-b719-4a22-b4b3-7698c51fcc7c","task":"Create a MetricFlow ratio metric in YAML to express a rate such as click-through rate from two existing measures","domain":"docs.getdbt.com","steps":["Identify or create the two simple metrics that will serve as the numerator and denominator (e.g., clicks and impressions)","Add a new metric entry with type: ratio and populate the numerator and denominator fields each referencing the corresponding metric name","Optionally add a filter string to either numerator or denominator individually if the rate should be scoped (e.g., only paid impressions in the denominator)","Run dbt sl query --metrics click_through_rate --group-by campaign_id,metric_time__day to test the output","Add the metric to a saved_queries block for reuse across BI integrations"],"gotchas":["Ratio metrics do not accept an expr field; if you need arithmetic beyond a simple numerator/denominator divide, use a derived metric with expr instead","Filters applied at the ratio metric level wrap both numerator and denominator by default; use separate numerator.filter or denominator.filter to apply scoped conditions independently","Division by zero is not handled natively in the metric definition; add a WHERE clause in your BI tool or wrap the downstream query in a NULLIF to guard against zero denominators"],"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:33.723Z"},"url":"https://mcp.waymark.network/r/4c114e48-b719-4a22-b4b3-7698c51fcc7c"}