The Salesforce Developers website will undergo maintenance on May 29, 2024 from 3:00 a.m. UTC to 10:00 a.m. UTC. The maintenance process may affect the availability of our documentation. Please plan accordingly.

Salesforce Data Cloud allows you to bring together data from disparate and disconnected systems across your company to help build a single view of your customer. In a previous blog post, we covered some of the cool features for developers in Salesforce Data Cloud. We promised a sequel on Insights, and here it is! Insights, which are calculated using Structured Query Language (SQL), allow you to segment, aggregate, and filter your data, so you can better analyze and interpret it. Let’s start by diving into data model objects.

What are data model objects?

Before we dive deeper into Insights, it’s important to talk about the underlying data model in Salesforce Data Cloud. This knowledge is foundational since data model objects contain the data that you will use for your insights. As mentioned above, Salesforce Data Cloud helps to consolidate disparate sources from multiple systems, such as CRM, Marketing Cloud, Commerce Cloud, and legacy systems. The Customer 360 Data Model then offers both standard and custom objects to map your data to from your source systems.

Let’s further break down the Customer 360 Data Model by explaining the parts of the diagram pictured below.

Relational diagram showing how subject areas relate to data model objects and attributes

A subject area gathers large chunks of data and brings them together in a general framework using data model objects. The business goal of most marketers is to market and promote their products or services to their customers. A marketer uses data model subject areas to group engagement data, sales orders, or product information together.

A data model object (DMO) is a grouping of data created from data streams, insights, and other data sources. Data model objects can be populated with data from Sales Cloud, Service Cloud, Marketing Cloud Engagement, Commerce Cloud, Mulesoft connected systems, and more. The DMO contains attributes, which are also called fields. An attribute is a specific piece of data stored in the Salesforce Data Cloud, for example, a customer’s first name, last name, or phone number.

Creating insights with SQL

Now that you understand the relationship between subject areas and DMOs, let’s look at insights. Insights let you calculate metrics on your data stored in Salesforce Data Cloud, and they are made using SQL. You don’t have to be an expert in SQL to build your insights, because Salesforce Data Cloud has a user-friendly, drag-and-drop builder that will help you create your SQL statements. However, it is helpful to have a basic understanding of SQL to fully comprehend what is going on behind the scenes as you are building out your insights.

Below is an example of the SQL structure that is being built as you create your calculated and streaming insights in Salesforce Data Cloud using the Insights Builder.

You will first select the attributes and measures that you can use to perform metrics on your attributes, such as sum. Then, you will choose the data model objects that you are selecting from, and any associated data model objects that you want to select from, as well as the attributes to create the join. You can use the where clause to add filtering criteria to include or exclude data. Finally, the group defines your dimensions. The diagram below shows how the joins help you to choose the correct data when dealing with multiple DMOs.

This image shows 4 different Venn diagrams of two data model objects. The first is a Venn diagram that shows an inner join, the second is a Venn diagram of a left join, the third is a Venn diagram for a right join, and the final Venn diagram shows a full join.

Calculated Insights

Calculated Insights lets you calculate metrics based on stored data in Salesforce Data Cloud. You can create insights based on the recency or frequency of usage of a company’s mobile apps. You can also calculate things like the most viewed product categories for an eCommerce site or engagement rates for emails.

With Calculated Insights, data is processed in high-volume batches. They can be used to define segment criteria and personalization attributes for activations using metrics, dimensions, and filters. Calculated insights can be packaged and shared with other instances of Salesforce Data Cloud.

Now, let’s look at a real-world example of how we may use Calculated Insights. Let’s say a Vice President of Marketing at a company wants to know the sales order data for the past year by customer, so that they can send a loyalty program promotional email to those customers. The Data Architect at the company has already set up Salesforce Data Cloud to connect with Commerce Cloud via Data Streams, and has already been ingesting sales order data into data model objects within Salesforce Data Cloud. Now the Data Architect needs to target those customers.

With the query above, the Data Architect is able to get exactly those customers that the VP of Marketing was targeting.

Streaming Insights

Although we just had some fun with Calculated Insights, we can’t forget about Streaming Insights. Streaming insights can be created from engagement data, and are processed and collected from streaming data sources such as the Web SDK, Mobile SDK, and the Ingestion API. You learned about those data sources in our previous article. Streaming insights help build time series aggregation in near real-time. They can share their data by mapping back to different objects from Web SDK, Mobile SDK, and Interaction Studio.

Imagine that you have an eCommerce company that allows your customers to make purchases via a mobile app. You want to capture in near real-time the number of customers that are beginning orders and placing items in their cart in five-minute intervals, so that if a customer doesn’t complete a purchase or abandons a cart, you can quickly send a follow-up text or push message encouraging them to complete their purchase. The example below shows how you can use a streaming insight to begin to identify the customers placing their orders via the mobile application, so that they can later identify and target abandoned customers.


We covered a lot in this blog post on insights within Salesforce Data Cloud. You should now have a foundational understanding of the underlying data architecture and how to retrieve data from data model objects in Salesforce Data Cloud. Below are some resources to help you further your learning on both Calculated and Streaming Insights within Salesforce Data Cloud.


About the author

Danielle Larregui is a Senior Developer Advocate at Salesforce focusing on the Marketing Cloud platform. She enjoys digital marketing, user experience design, user interface design, and mobile development. You can follow her on Twitter @DnLarregui.

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS