Weld logo
hubspot logo
Hubspot

Closed won deals amount by owner

Retrieves the total amount of closed won deals for each owner in HubSpot and orders them in descending order.
1select
2    concat(owners.firstName, ' ', owners.lastName) as deal_owner
3  , sum(properties_amount) as amount
4from
5    {{raw.hubspot.deals}} as deals
6    left join {{raw.hubspot.owners}} as owners on cast(owners.id as int) = deals.properties_hubspot_owner_id
7where
8    properties_dealstage = 'closedwon'
9group by
10    deal_owner
11order by
12    amount desc
Example of output from model:
+------------------+----------+
|   deal_owner     |  amount  |
+------------------+----------+
|   John Smith     |   50,000 |
+------------------+----------+
|   Jane Doe       |   30,000 |
+------------------+----------+
|   Bob Johnson    |   20,000 |
+------------------+----------+

This SQL model allows you to easily track the amount of closed won deals by owner, giving you valuable insights into the performance of your sales team. By joining the HubSpot deals and owners tables, this SQL model creates a list of all closed won deals and the corresponding owner's name. The results are then grouped by owner and sorted by the total amount of closed won deals, allowing you to quickly identify your top-performing salespeople. This SQL template is an excellent way to measure the success of your sales team and identify areas for improvement.

Ready to start modeling your own hubspot data?

Get started building your data warehouse with hubspot and connect all your apps and databases.

hubspot logo
Weld logo
Sign up for free
© 2024 Weld. All rights reserved.