Overview: Query Builder for HubSpot Marketing (Emails)
How to access the Query Builder for HubSpot Marketing (Emails)

Navigate to Metrics > Query Builder to access the Query Builder for HubSpot Marketing. Click the green + Create Custom Metric button and select your connected HubSpot Marketing Account from the Data Source drop-down list. Select the Email button.
Query Builder is available in Plus and Business Accounts. Agency Basic Accounts have access to Query Builder in the Agency Account only. Request a trial of Query Builder by following
these steps.
How to use the Query Builder for HubSpot Marketing (Emails)

A
Email Name:
Enter a name for your Custom Metric. This Custom Metric name will be available in the Designer after saving.
B
Metric: Select a Metric from your connected HubSpot Marketing Data Source, such as "Sent," "Clicked or "Unsubscribed."
C
Select Emails: From the
Select Emails section, you can select specific Emails from your HubSpot Account that you want to collect data for. These Emails will be the only ones that are included in the Custom Metric.
D
Email Filters: From the
Email Filters section, you can enter text that the Email Name in the HubSpot Account must "contain" or "not contain." For example, if all internal Emails in your HubSpot Account have "Internal" in the Email Name, you can set a Filter to exclude all Emails that contain "Internal" in the Email Name for your company's dashboard.
E
Group and Summarize Email Values: By default, the Custom Metric will return a list of Email Names and their associated Metric Values. This is great to display on a Table or Pie Chart.
There are also cases where it's valuable to have 1 aggregated number to report on high-level data. In order to do this, check the Group and Summarize Email Values checkbox. This will aggregate all of the individual email values that were returned into one high-level Metric.
F
Group and Summarize Email Values: Data Preview: After clicking Run query, a Data Preview of the Custom Metric will be displayed. If there is no data returned for the current day, no data will be displayed in the Data Preview.
How to create a Custom Email Metric [Example]
In this example, we'll create a Custom Metric to return a single value representing the number of Emails Sent that contain "Blog" in the Email Name.

1
Navigate to
Metrics > Query Builder
2
Click the green
+ New query button
3
Select the appropriate HubSpot Marketing Data Source and the
Emails button
4
In order to accurately explain what this Custom Metric is reporting on, we'll name the Custom Metric
"Blog" Emails Sent
5
Rather than selecting individual Emails in the
Select Emails section, we will be setting a Filter in the
Email Filters section
6
Select
Email Name as the
Property, Contains as the
Operator. We'll type
blog into the
Value textbox so all Emails that contain "blog" in the Email Name will be included in this Custom Metric.
7
We want 1 Value returned from this Custom Metric that reflects the total number of Emails Sent that promoted our Blog. So, we will check the
Group and summarize email values checkbox.
8
Click
Run query to generate a Data Preview of the Custom Metric
9
Once we confirm that these are the results we're looking for, we'll click
Save to save the Custom Metric
How to add a Custom Blog Metric to a Databoard

1
Open the selected Databoard in the Databox Designer, or create a new Databoard.
2
Drag and drop a blank Datablock onto the Databoard from the Visualization Library.
3
Select the appropriate HubSpot Marketing Data Source from the righthand
Datablock Settings panel. This must be the same HubSpot Marketing Account that was selected when creating the Custom Metric.
4
Select the
Custom tab at the top of the
Metric drop-down list.
5
Select the Custom Metric name to populate the Datablock.
Additional Info
- Due to an API limitation, Custom Metrics built using this Query Builder will only show the All Time (total) data. This means that when a Custom Metric is created, no data will be returned for Date Ranges that don't include "Today." Data will continue to accumulate for this Custom Metric over time.
Date Ranges such as "Week to Date" and "This Month" include "Today." Date Ranges such as "Last 7 Days" and "Last 90 Days" do not. Learn more about the parameters for each Date Range here.
- If there is no data returned for the current day, no data will be displayed in the Data Preview.
- Data is only available for Emails that have gone live.