Deals by deal stage
1select
2 pipeline_stage.label as deal_stage
3 , count(*) as number_of_deals
4from
5 {{raw.hubspot.deals}} as deals
6 left join {{raw.hubspot.pipeline_stage}} as pipeline_stage on pipeline_stage.stage_id = properties_dealstage
7group by
8 pipeline_stage.label
+----------------------+-----------------+
| deal_stage | number_of_deals |
+----------------------+-----------------+
| Appointment | 10 |
+----------------------+-----------------+
| Qualification | 25 |
+----------------------+-----------------+
| Presentation | 15 |
+----------------------+-----------------+
| Negotiation | 5 |
+----------------------+-----------------+
| Closed Won | 20 |
+----------------------+-----------------+
| Closed Lost | 5 |
+----------------------+-----------------+
This SQL model allows you to easily track the number of deals in each stage of your sales pipeline. By selecting the pipeline_stage.label as deal_stage and counting the number of deals, you can quickly see how many deals are in each stage of your pipeline. This information can be incredibly useful for sales managers who want to identify bottlenecks in their sales process and make data-driven decisions to improve their team's performance. The SQL code is integrated with HubSpot, so you can easily access your data and generate insights that will help you close more deals. With the Deals by Deal Stage SQL template, you can take your sales pipeline management to the next level and drive more revenue for your business.