Weld logo

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.
2    concat(owners.firstName, ' ', owners.lastName) as deal_owner
3  , sum(properties_amount) as amount
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
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 100+ more apps and databases available.

Weld logo
Sign up for free
Weld logo

Tired of scattered data? Sync your data in minutes with Weld. Connect to 150+ apps, files and databases.

Backed by leading investors
Frontline logoCherry logoInnnovation Fund logo
Twitter LogoLinkedIn Logo
© 2024 Weld. All rights reserved.