Five example metric queries, with calculation rules, assumptions, and policy choices. The tables describe a proposed Salesforce and billing schema.
Snowflake SQL examples · Tested with small local fixtures · Not connected to a warehouse
Current ACV of open opportunities in Qualified, Demo, Proposal, or Negotiation. The example assumes one row per opportunity and account. Direct stage filtering avoids multiplying amounts through a repeated stage lookup.
-- Qualified Pipeline: Current ACV of all open opportunities at Stage 2+-- Example owner: Rev Ops | Proposed refresh: Daily 6:00 AM ET | Source: Salesforce OpportunitySELECTo.owner_name AS rep,a.specialty_segment AS specialty,o.lead_source AS source_channel,COUNT(*) AS deal_count,SUM(o.acv) AS pipeline_acv,AVG(o.acv) AS avg_deal_size,MEDIAN(o.acv) AS median_deal_sizeFROM salesforce.opportunity oJOIN salesforce.account aON o.account_id = a.account_idWHERE o.stage_name IN ('Qualified', 'Demo', 'Proposal', 'Negotiation')AND o.is_closed = FALSE -- Exclude won and lostAND o.acv >= 5000 -- Floor: exclude sub-$5K trialsAND o.is_deleted = FALSEGROUP BY 1, 2, 3ORDER BY pipeline_acv DESC;
Example policy choice: count opportunities from Qualified onward. Keep prospecting and unconverted leads in separate views. A real implementation needs agreement on stage names, qualification criteria, and ACV.
Local regression fixtures check repeated stages, excluded opportunities, closed-cohort denominators, and retained churn. Snowflake execution and dbt integration have not been validated. Before use, map the schema, enforce unique opportunity/account keys, confirm complete billing periods, and reconcile results to source totals.