Weld logo

Tasks completed by owner

Retrieves the number of completed tasks for each owner in Hubspot, using a left join between the engagements and owners tables. The result includes the owner's first and last name, as well as the count of completed tasks.
2    concat(owners.firstName, ' ', owners.lastName) as owner
3  , count(*) as tasks_completed
5    {{raw.hubspot.engagements}} as engagements
6    left join {{raw.hubspot.owners}} as owners on cast(owners.id as integer) = engagements.ownerId
8    type = 'TASK'
9    and json_value(metadata, ' .status') = 'COMPLETED'
10group by
11    owner
Example of output from model:
|      owner       | tasks_completed |
| John Smith       | 10              |
| Jane Doe         | 5               |
| Michael Johnson  | 3               |
| Sarah Williams   | 8               |

This SQL model allows you to easily track the number of completed tasks for each owner in your organization. By joining the engagements and owners tables, the SQL code creates a list of owners and the number of tasks they have completed. This information can be used to identify top performers, track progress towards goals, and identify areas where additional support may be needed. The output of this SQL code is a table that displays the owner's name and the number of tasks they have completed. This SQL template is a valuable tool for any business looking to optimize their sales process and improve team performance.

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? Build your data warehouse with Weld in minutes with our powerful ELT, SQL Transformations, Reverse-ETL and AI Assistant - connected to 100+ apps, files and databases.

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