Forecasting HubSpot Deal Revenue and Project Resourcing using dbt, Google BigQuery and Looker

    markrittman
    Jan 7, 2020
    BigQuery
    Data Engineering
    dbt
    Looker
    Modern Data Stack

    Last week in our blog on using dbt and Looker to analyze Hubspot CRM data we talked about metrics that let us look back at the history of a deal to understand deal velocity and measure open and active deals at any particular point in the past.

    In this blog I wanted to share how we use that same data to forecast our likely revenue in the coming months, and how we use this forecasting technique along with some custom Hubspot deal properties to predict what resources and skills we’ll need to deliver the projects we’re forecasting.

    In out Hubspot deals table, as processed previously in dbt tidy-up and cleanse the raw data coming from Hubspot via Stitch, a typical row of deal data contains these columns relevant to a revenue forecast:

    • The predicted start and end date of the deal, typically a consulting engagement of two or three two-week duration development sprints, along with the duration of the engagement in days

    • The sales funnel stage for the deal as of now; we’ve excluded those deals either lost, or won and already delivered

    • The predicted deal value, and a probability percentage based on current deal stage that when used as a modifier (multiplier) with the deal amount gives us a weighted pipeline deal value

    What we’d like to do is forecast, based on the estimated start and end dates of our open deals and the current weighted pipeline value of that deal, what our revenue numbers are likely to look like over the total duration of those deals.

    In dbt we can do that by taking this deals data and using it to work out what revenue each deal brings in over the time it’s active, then joining those daily revenue amounts to a date array table we create on the fly to first aggregate each deal’s total revenue over those days, and then calculate the total revenue per month from all of those forecasted deals.

    {{config(materialized=’table’)}}WITH daily_weighted_revenue as (SELECT*,(amount * probability) / nullif(contract_days,0) AS contract_daily_weighted_revenue,amount / contract_days AS contract_daily_full_revenue,(amount / contract_days) – ((amount * probability) / contract_days) AS contract_diff_daily_revenueFROM (SELECT*,TIMESTAMP_DIFF(end_date_ts,start_date_ts,DAY) AS contract_daysFROM (SELECTdealname,deal_id,amount,probability,start_date_ts,end_date_tsFROM{ }WHEREstage_label not in (‘Closed Lost’,’Closed Won and Delivered’)GROUP BY1,2,3,4,5,6,7))),months as (SELECT *FROM UNNEST(GENERATE_DATE_ARRAY(‘2019-01-10’, ‘2024-01-01’, INTERVAL 1 DAY)) day_ts)SELECT deal_id,date_trunc(day_ts,MONTH) as month_ts,sum(revenue_days) as revenue_days,sum(daily_weighted_revenue) as weighted_amount_monthly_forecast,sum(daily_full_revenue) as full_amount_monthly_forecast,sum(daily_diff_revenue) as diff_amount_monthly_forecastfrom (SELECT deal_id,day_ts,count(*) as revenue_days,sum(contract_daily_weighted_revenue) daily_weighted_revenue,sum(contract_daily_full_revenue) daily_full_revenue,sum(contract_diff_daily_revenue) daily_diff_revenueFROM months mJOIN daily_weighted_revenue dON TIMESTAMP(m.day_ts) between d.start_date_ts and timestamp_sub(d.end_date_ts, interval 1 day)GROUP BY 1,2)GROUP BY 1,2

    Bringing the table that dbt creates for this SQL query into Looker and joining it to our main Hubspot-sourced deals table, we can now predict revenue over the coming few months based on start date and length of deal with each deal value weighted based on its current deal stage to allow for the fact that not all deals will close.

    In addition to recording revenue for our deals in Hubspot we also use custom deal properties to record aspects of the deal such as what products are likely to be part of the solution, how many sprints and of what type will be needed and who within the team we’re thinking of assigning the project to.

    Now I can predict overall and individual workload for each of our consulting team, like this:

    I can see how these forecasted projects are being priced:

    And finally, useful for training and recruitment planning, I can see what technology skills our team need to have to service these deals and when.

    For more details of what we can do for you with dbt, check the new dbt Solutions page and Data Centralization solution page on our website.

    Share:

    Recommended Posts

    One Person Many Roles: Designing a Unified Person Dimension in Google BigQuery

    One Person Many Roles: Designing a Unified Person Dimension in Google BigQuery

    Jan 26, 2026
    Analytics Engineering
    BigQuery
    +3
    How Rittman Analytics uses AI-Augmented Project Delivery to Provide Value to Users, Faster

    How Rittman Analytics uses AI-Augmented Project Delivery to Provide Value to Users, Faster

    Jan 19, 2026
    Data Engineering
    dbt
    +3
    Opinionated, AI-Enabled & Modern: The Story Behind Rittman Analytics’ New Website

    Opinionated, AI-Enabled & Modern: The Story Behind Rittman Analytics’ New Website

    Aug 29, 2025
    BigQuery
    Data Engineering
    +4

    Recent Posts

    Agentic Data Platform Migration using Wire, Claude Code and Rittman Analytics

    Jul 19

    Making Agentic Analytics More Accurate using Anthropic’s Agentic Data Stack and the Wire Framework

    Jun 11

    Google Next 2026: What’s New for Looker, BigQuery, Data Platforms and Agentic Analytics

    Apr 26

    Introducing the Wire Framework: The “Secret Sauce” Behind Our AI-Augmented Analytics Project…

    Feb 25

    So, Just How Relevant is Multi-Touch Attribution to Marketers in 2026?

    Jan 28

    One Person Many Roles: Designing a Unified Person Dimension in Google BigQuery

    Jan 26

    Why We’ve Tried to Replace Data Analytics Developers Every Decade Since 1974

    Jan 19

    How Rittman Analytics uses AI-Augmented Project Delivery to Provide Value to Users, Faster

    Jan 19

    Rittman Analytics 2025 Wrapped : A Year of Platforms, People and High-Performing Data Teams

    Jan 19

    You Probably Don’t Need an RFP

    Jan 19
    Page 1 of 24
    Looking for a partner on your data analytics journey?

    Published Year

    2026
    (10)
    2025
    (18)
    2024
    (27)
    2023
    (23)
    2022
    (19)
    2021
    (12)
    2020
    (20)
    2019
    (32)
    2018
    (26)
    2017
    (18)
    2016
    (32)

    Tag Cloud

    Modern Data Stack (91)Data Engineering (85)BigQuery (59)Looker (56)Business Intelligence (BI) (49)Analytics Engineering (47)dbt (34)Data Quality (23)Oracle (16)Google Cloud (GCP) (15)Fivetran (12)Automation (11)Dashboards (9)Financial Analytics (5)Generative AI (5)Semantic Layer (3)single-post (3)Cube.js (3)Chatbots / Conversational Analytics (2)Embedded Analytics (2)Vertex AI (1)OpenAI (1)Looker Studio (1)LLMs (Large Language Models) (1)