Certified? Now Deliver Smarter—Use AI Agents to Implement Salesforce 10x Faster. Get Your Agents

Certified? Now Deliver Smarter—Use AI Agents to Implement Salesforce 10x Faster. Get Your Agents
Salesforce Data Cloud Segments and Calculated Insights

Salesforce Data Cloud Segments and Calculated Insights

Understanding and leveraging customer loyalty points is crucial for businesses to reward and retain their customers effectively. In this guide, we’ll delve into the process of calculating the sum of total loyalty points accrued per unified individual and individual using Salesforce and AWS S3. 

We will explore how these points are stored, linked, and calculated through Salesforce’s query editor and calculated insights features.

salesforce data cloud + agentforce bootcamp

Understanding the Storage of Loyalty Points

Loyalty points are stored in the Sales Order Data Model Object (DMO). To begin, we will use the Data Exploration Query Editor to examine how this data is structured. Within the Sales Order object, loyalty points are stored in a specific column, and customers are linked via the “sold to customer ID” field. Running a query in the editor reveals the loyalty points accrued for various orders placed by customers.


Querying Individual and Unified Individual Data

Next, we must consider how engagement-related information links to individual records. This involves querying the Individual and Unified Individual objects. The key fields of interest are the individual IDs from both objects. Additionally, we need to understand how the Unified Individual and Individual objects are connected through the Unified Link Individual object. This linkage is essential for accurately consolidating loyalty points across different data sources.


Also Read: Effective Data Object Mapping From Salesforce CRM to Data Cloud

Creating the Query for Calculated Insights

To calculate the sum of loyalty points, we need to construct an SQL query that sums the loyalty points from the Sales Order object and joins it with the relevant fields from the Unified Individual and Individual objects. Here is the detailed query breakdown:

  1. Sum of Loyalty Points: We start by summing the loyalty points from the Sales Order object.
  2. Joins: The query joins the Sales Order object with the Unified Link Individual object on the “sold to customer ID” and “source record ID” fields.
  3. Traversal to Unified Individual: The Unified Link Individual object is then joined with the Unified Individual object using the “unified record ID.”
  4. Traversal to Individual: Finally, we join the Unified Link Individual object with the Individual object using the “source record ID.”

The final query includes a GROUP BY clause to aggregate the loyalty points by the Unified Individual and Individual IDs.


Also Read: Mapping of Engagement Data From AWS S3 DLO to DMO

Creating Calculated Insights

With the query ready, the next step is to create the calculated insight in Salesforce. Navigate to the Calculated Insights section and create a new insight using the SQL query. Name the insight “Total Loyalty Points per Customer” and verify the query syntax. After successful validation, activate the insight and choose a scheduling option. For this example, we select the “not schedule” option and publish the insight, initiating a batch process to calculate the insights.


Verifying the Calculated Insights

After the batch process completes, we can verify the results by querying the “total loyalty points per customer” calculated insight object. Using the Data Exploration Query Editor, we query this object to see the total loyalty points for each customer. Ordering the results by total loyalty points in descending order reveals which customers have accrued the most points.



Explore our Salesforce Data Cloud series on YouTube for expert guidance and tips on leveraging Salesforce Data Cloud effectively.

Conclusion

By following this guide, you can effectively calculate and analyze customer loyalty points using Salesforce and AWS S3. This process involves understanding how data is stored and linked across different objects and creating calculated insights to aggregate and report on this data. Leveraging these insights allows businesses to understand customer behavior better and enhance their loyalty programs.

Looking to improve your Salesforce expertise? Explore our Salesforce Data Cloud Consultant course. Start a free trial to access over 24 Salesforce certification courses, more than 50 mock exams, and 50+ hands-on Salesforce labs. 

Elevate your career and simplify your learning journey with saasguru today!

Table of Contents

Subscribe & Get Closer to Your Salesforce Dream Career!

Get tips from accomplished Salesforce professionals delivered directly to your inbox.

Looking for Career Upgrade?

Book a free counselling session with our Course Advisor.

By providing your contact details, you agree to our Terms of use & Privacy Policy

Unlock Your AI -Powered Assistant

Gain Exclusive Access to Your Salesforce Copilot

Related Articles

Salesforce Certified Agentforce Specialist Practice Exam Questions and Answers

Prepare for the Salesforce Certified Agentforce Specialist exam with real practice questions & answers. Boost your AI agent skills & pass with confidence!

Will AI Replace Entry-Level Salesforce Professionals?

Will AI replace entry-level Salesforce professionals? Discover AI’s impact, limitations, and how to future-proof your Salesforce career in the AI era.

The Role of Metadata in Creating a Large-Scale AI Agent Network

Discover how metadata powers large-scale AI agent ecosystems, enabling scalability, collaboration, and automation for intelligent AI-driven applications.