Skip to main content

Create Insights in Data Cloud

Learning Objectives

After completing this unit, you’ll be able to:

  • Identify methods for creating insights.
  • Create both calculated and streaming insights.

Before You Begin

In this module, we assume you have the proper permission to create insights. We also assume you are a data architect or a technical marketer who is familiar with SQL. While you don’t have to be a SQL expert to use insights (there is a builder to assist you), it’s helpful to understand core SQL concepts. We recommend reviewing Data Cloud Insights Using SQL before you begin creating insights. Lastly, don’t try to follow these steps in your Trailhead Playground. Data Cloud isn’t available in the Trailhead Playground.

Create Calculated Insights

There are four ways to build new insights in Data Cloud. 

  1. Create with Builder
  2. Create from a Package
  3. Create with SQL
  4. Create Streaming Insights

Create a new calculated insights screen with four options.

Let’s review each creation type.

Method

Description

More Info

Create with Builder

If you’re not familiar with SQL, you can build both calculated and streaming insights using the builder tool in Data Cloud. This tool allows you to drag and drop elements to build your SQL statements. 

Learn more about the builder in the badge Insights Builder in Data Cloud.

Create from a Package

If you or a colleague has created and tested a calculated insight in another org, you can create an insight from an installed Salesforce package.

Learn more about how to create packages in the badge Packaging and Data Kits in Data Cloud.

Create with SQL

Write SQL expressions to create your metrics and dimensions from mapped objects and fields.

Learn more about options and limitations from the Calculated Insights help page.  

Create Streaming Insights

Using a similar interface to calculated insights, you can write SQL expressions to compute streaming metrics across dimensions from your real-time data sources.  

Learn more about options and limitations from the Streaming Insights help page.

Build a SQL Expression

Since insights are based on SQL, let’s review the SQL interface and how you can build an expression. On the create with SQL interface, you have various options including tabs for fields, insights, and functions (1). You can also view examples (2) and check your work directly in the interface by clicking Check Syntax (3). 

New Calculated Insight UI screen with fields, insights, and functions circled, along with examples and check syntax.

Let’s review your interface options.

  • Fields: Select from your data model fields to add the field API name directly to your expression.
  • Insights: Select from any previously created insights.
  • Functions: Select certain functions grouped by: Aggregation, Datetime, and Other.

Build Your Expression

Using the interface options, you can insert the needed fields and functions into a provided SQL Expression structure. 

SELECT <Attributes>, <Aggregation[_Measures_]>
FROM <Data Model Object>
JOIN [Inner | Left | Right | Full] <Data Model Object> [Optional]
WHERE <predicate on rows> [Optional]
GROUP BY <columns[_Dimensions_]>

As you add the elements needed for your expression, it’s important to note a few requirements if you plan to use your calculated insight in segmentation.

  • Include the data stream you segment on as a JOIN.
  • The data stream primary key must also be listed as a dimension.

A dimension is a qualitative value that is used to categorize a measure. For example, say you want to create an audience segment based on your unified individuals. You would JOIN on unified individual and include a GROUP BY of unified individual ID as your dimension and primary key. 

Build a Streaming Insight Expression

The streaming insight expression interface is very similar to calculated insights, except you don’t have the option to use existing insights. And you need to account for a window of time like in this example. 

SELECT COUNT( RealTimeMobileEvents__dlm.pageviews__c ) as page_views__c,
ssot__Individual__dlm.ssot__Id__c as customer_id__c,
RealTimeMobileEvents__dlm.product__c as product__c,
WINDOW.START as start__c,
WINDOW.END as end__c
FROM
RealTimeMobileEvents__dlm
JOIN
ssot__Individual__dlm
ON
ssot__Individual__dlm.ssot__Id__c = RealTimeMobileEvents__dlm.deviceId__c
GROUP BY
window( RealTimeMobileEvents__dlm.dateTime__c ,'5 MINUTE'),
customer_id__c
Note

Need a refresher and more examples? Be sure to review Data Cloud Insights Using SQL.

Next Up: Use Your Insights

Now that you know how to create both calculated and streaming insights, let’s review how you can view and use your insights in Data Cloud. 

Resources

Teilen Sie Ihr Trailhead-Feedback über die Salesforce-Hilfe.

Wir würden uns sehr freuen, von Ihren Erfahrungen mit Trailhead zu hören: Sie können jetzt jederzeit über die Salesforce-Hilfe auf das neue Feedback-Formular zugreifen.

Weitere Infos Weiter zu "Feedback teilen"