Go HighLevel model

Pipeline snapshot

The HighLevel Opportunities board as numbers: how many deals and how much value sit in each stage of each pipeline right now, and how long they have been there.

Grain
one row per location x pipeline x stage x status, as of the last sync
Built from
  1. 3
    Raw tables
  2. 3
    Staging
  3. 1
    Core
  4. 1
    Analytics
Reads from Go HighLevel
opportunitypipelinepipeline_stage
Ships as
Weld and dbt SQL, open source on GitHub
core.go_high.pipeline_snapshot
1-- core.go_high.pipeline_snapshot
2-- The HighLevel Opportunities board as numbers: how many deals and how much value sit in
3-- each stage of each pipeline right now, and how long they have been there.
4--
5-- Grain: one row per location x pipeline x stage x status, as of the last sync.
6-- Depends on: staging.go_high.opportunity, .pipeline, .pipeline_stage
7--
8-- Open deals are the board. Won, lost and abandoned deals stay attached to the stage they
9-- were in when they closed, so they are kept as separate rows by `status` rather than
10-- mixed into the open value.
11-- `avg_days_in_stage` uses the last stage change, so it is the age of the deal in its
12-- current stage, measured at sync time.
13
14SELECT
15    o.location_id,
16    o.pipeline_id,
17    p.pipeline_name,
18    o.pipeline_stage_id,
19    s.stage_name,
20    s.stage_position,
21    o.status,
22
23    COUNT(*)                                                    AS opportunities,
24    SUM(o.monetary_value)                                       AS total_value,
25    AVG(o.monetary_value)                                       AS avg_value,
26    AVG(TIMESTAMP_DIFF(CURRENT_TIMESTAMP(),
27        COALESCE(o.last_stage_change_at, o.created_at), HOUR) / 24) AS avg_days_in_stage,
28    COUNTIF(o.assigned_user_id IS NULL)                         AS unassigned
29FROM {{staging.go_high.opportunity}} o
30LEFT JOIN {{staging.go_high.pipeline}} p        ON p.pipeline_id = o.pipeline_id
31LEFT JOIN {{staging.go_high.pipeline_stage}} s  ON s.pipeline_stage_id = o.pipeline_stage_id
32GROUP BY 1, 2, 3, 4, 5, 6, 7

This model and the 4 it depends on. Deploy them together; refs like {{staging.…}} resolve to the matching folders in Weld, and the dbt view uses source() and ref().

Notes

How it counts. And where it stops.

Open deals are the board. Won, lost and abandoned deals stay attached to the stage they were in when they closed, so they are kept as separate rows by `status` rather than mixed into the open value. `avg_days_in_stage` uses the last stage change, so it is the age of the deal in its current stage, measured at sync time.

Raw tables it reads

  • raw.go_high.opportunity
  • raw.go_high.pipeline
  • raw.go_high.pipeline_stage

Put Go HighLevel in front
of your agents.

Connect Go HighLevel, deploy the models, and ask questions in Claude, Cursor or ChatGPT. Free for 14 days, no credit card.