Overview: Query Builder for Salesforce

With the Query Builder for Salesforce, you can create Custom Salesforce Metrics using a combination of Metrics, Dimensions and Filters. Some popular use cases for the Query Builder for Salesforce include 

HOW TO

How to access the Query Builder for Salesforce

Navigate to  Data Manager > Query Builder to access the Query Builder for Salesforce. Click the green + Create Custom Metric button and select your connected Salesforce Account from the Data Source drop-down list.

    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 Salesforce

The Query Builder for Salesforce is unique in that it allows you to use the Databox Query Builder or Salesforce Object Query Language (SOQL) to create Custom Metrics. 

IN THIS SECTION

Query Builder

A
  Custom Metric Name:  Enter a name for your Custom Metric. This Custom Metric name will be available in the Designer after saving. 
B
  Object: Select an Object from your Salesforce Data Source, such as "Account," "Lead," or "Opportunity." This selection determines where the data is being synced from the Salesforce Account and what data is included in the returned Custom Metric value.
C
  Date Range: Select up to 8 Date Ranges that will be available for the Custom Metric. The Date Ranges selected are the only periods of time that data is synced for this Custom Metric. 
D
  Compare With(Optional): Select a comparison period to measure each Date Range against, like "Previous Period" or "Same Period Last Year." Data for the comparison period will be synced for each Date Range that is selected. 

This data can be used on a Line Chart or Bar Chart to show past performance. It is also used to calculate the percentage growth or loss of the current Date Range performance vs the comparison Date Range performance. If no Compare With parameter is selected, comparison percentages cannot be displayed for the Custom Metric. 
E
  Date Field: The Date Field determines which Deals will be included in the Custom Metric. For example, if "Create Date" is selected, any Deals created during the specified Date Range(s) will be included in the Custom Metric. If "Close Date" is selected, any Deals Closed during the specified Date Range(s) will be included in the Custom Metric.
F
  Data Type: Selecting the appropriate Data Type ensures that your Custom Metrics will be synced correctly in Databox. Typically, Daily Values is selected for these Metrics because data is syncing multiple times each day. 
  • Daily Values: This Data Type should be selected when your Metric reflects a single entry out of the whole Value(s) for the Metric. In Databox, the aggregated Value of daily entries will be displayed for the Custom Metric. 
  • Total Values: This Data Type should be selected when your Metric Value reflects the most up-to-date Value(s) for the Metric. In Databox, the latest entry Value will be displayed for the Custom Metric. 

    For longer Date Ranges, data will be not aggregated and the latest Value will be displayed for the selected Date Range. This is the main difference between "Total Values" and "Daily Values." 
G

  Metric: Select a Metric from your connected Salesforce Data Source, such as "Lead ID" or "Opportunity ID." In general, the Object selection determines the Metric options. 

H

  Metric Operation: The Metric Operation field determines how the system will handle multiple results that are returned from the Salesforce Account. 

For example, if you create a Custom Metric called "New Leads," you'd want to select Lead ID as the Metric and Count as the Metric Operation. This will make it so each Lead ID that is returned from the Salesforce Account will simply be counted (+1) and the actual ID Values won't be used. 
I

  Dimension (Optional): The Dimensions parameter re-categorizes the returned Metric value based on common criteria. Examples of Dimensions are "Lead Source" and "Campaign."

Pro Tip:  Add the word "by" in between the Metric and Dimension in order to determine an appropriate Custom Metric Name. From the Metric and Dimension examples outlined above, we could create the Custom Metrics "Reach by Campaign," "Clicks by Region," or "Impressions by Device Platform." 
J
  Filter by (Optional):  Filters restrict the data that gets included in the Custom Metric. All data that is returned is tested against the Filter(s). Multiple Filters can be combined using AND/ OR boolean logic. 
If the data synced from the Metric and Dimension fields meet the Filter specifications, the data is retained and included in the Custom Metric value. If the data synced from the Metric and Dimension fields don't meet the Filter specifications, the data is excluded from the Custom Metric value.
K
  Data Preview: After clicking Run query, a Data Preview of the Custom Metric will be displayed. Daily Metric values are displayed in this section, along with the total Metric values for the Date Range in bold at the bottom. You can view the Data Preview for different Date Ranges by clicking on the tabs at the top of the Data Preview. 
Pro Tip : If you don't know which Filters to put in place for your use case, use the Dimension + Data Preview to troubleshoot and get more insight into the data that is returned from your Salesforce Account for each field. Learn more here.

SOQL Query

A
  Custom Metric Name: Enter a name for your Custom Metric. This Custom Metric name will be available in the Designer after saving. 
B
  SOQL: Construct query strings to access your Salesforce data using Salesforce Object Query Language (SOQL). SOQL is similar to the SELECT statement used in Structured Query Language (SQL), but it is designed specifically for Salesforce data. 
Learn more about SOQL here
C
  Data Type: Selecting the appropriate Data Type ensures that your Custom Metrics will be synced correctly in Databox. 
  • Daily Values: This Data Type should be selected when your Metric reflects a single entry out of the whole Value(s) for the Metric. In Databox, the aggregated Value of daily entries will be displayed for the Custom Metric. 
  • Total Values: This Data Type should be selected when your Metric Value selection reflects the most up-to-date Value(s) for the Metric. In Databox, the latest entry Value will be displayed for the Custom Metric. 

    For longer Date Ranges, data will be not aggregated and the most recent Value will be displayed for the selected Date Range. This is the main difference between "Total Values" and "Daily Values." 
  • Event Values: This Data Type should be selected when your Metric Value selection reflects individual Value(s) for the Metric at the specified Date/ Timestamp. This Data Type is the default selection because it is appropriate for the majority of use cases. 

    For longer Date Ranges, individual Metric Values will be aggregated for the entire Date Range and the aggregated Value will be displayed for the Custom Metric. 
D

  Data Preview: After clicking Run query, a Data Preview of the Custom Metric will be displayed. Daily Metric values are displayed in this section, along with the total Metric values for the Date Range in bold at the bottom. You can view the Data Preview for different Date Ranges by clicking on the tabs at the top of the Data Preview. 

How to create a Custom Salesforce Metric [Example]

In this example, we'll create a Custom Metric to report on New Opportunity Amounts from Organic Traffic, split up based on the current Stage of the Opportunity. 

1
 Navigate to Data Manager > Query Builder   
2
 Click the green + New query button
3
 Select the appropriate Salesforce Data Source
4
 In order to accurately explain what this Custom Metric is reporting on, we'll name the Custom Metric "New Opportunity Amount (Organic) by Stage" 
5
  We'll build this Custom Metric using the Databox Query Builder, so we'll select the Builder button
6
 We want to report on Opportunities, so we'll choose Opportunity as the Object. This will ensure we're syncing data from the appropriate place in the Salesforce Account
7
 Next, we'll select the Date Range options for our Custom Metric. We will choose Week to Date, Month to Date, Quarter to Date, Year to Date, and Last Month as Date Range options
8
 We want to view our current performance compared to the previous period, so we'll choose Previous Period as the  Compare With selection
9
 We want to report on New Opportunities, meaning the Create Date is the appropriate Date Field to select
10
 The default Data Type, Daily  Values, works for our use case so we will not change this selection
11
 As outlined by our Custom Metric Name, we're interested in reporting on the Amount associated with each Opportunity. Therefore, we will choose Amount as the Metric
12
 Individual Opportunity Amounts will be synced from this Salesforce Account. We want all of those Metric values added together, so we'll choose SUM as the Metric Operation
12
 We want all Opportunity Amount split up based on the Stage of the Opportunity, so we'll choose Stage as the Dimension
13
 We only want to include Opportunities that came from Organic traffic, so we'll add a Filter to only retain data if Lead Source = Organic
14
 Click Run query to generate a Data Preview of the Custom Metric  
15
 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 Salesforce 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 Salesforce Data Source in the righthand Property Manager. This must be the same Salesforce 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 Information

  • Dates must be entered with the following Format: YYYY-MM-DD
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us