New deals by month
1select
2 date_trunc(createdAt, month) as month
3 , count(*) as deals
4from
5 {{raw.hubspot.deals}}
6group by
7 month
8order by
9 month
+------------+-------+
| month | deals |
+------------+-------+
| 2019-01-01 | 150 |
| 2019-02-01 | 200 |
| 2019-03-01 | 175 |
| 2019-04-01 | 225 |
| 2019-05-01 | 300 |
| 2019-06-01 | 250 |
| 2019-07-01 | 275 |
| 2019-08-01 | 350 |
| 2019-09-01 | 400 |
| 2019-10-01 | 375 |
| 2019-11-01 | 450 |
| 2019-12-01 | 500 |
+------------+-------+
This SQL model allows you to quickly and easily analyze your sales data by grouping deals by the month they were created. By using the date_trunc function, the SQL template aggregates all deals created in a given month and returns the total number of deals for each month. This information can be incredibly useful for identifying trends in your sales data, such as which months are the busiest or slowest for your business. With this insight, you can adjust your sales strategy accordingly and optimize your sales performance. The New Deals by Month SQL template is a must-have for any business looking to gain a deeper understanding of their sales data and improve their bottom line.