Calculated Insight: Customer Lifetime Value

The Customer Lifetime Value calculated insight aggregates the lifetime revenue generated from the sale of vehicles, services, parts, and accessories for a specific customer. The lifetime value of a customer includes the purchase of vehicles, parts, subscriptions, and accessories from the original equipment manufacturer and from dealerships. The insight also considers the order value from repair and maintenance of vehicles and parts.

Required Editions

Available in: Enterprise, Unlimited, and Developer Editions

Here’s a breakdown of the logic.

Expression Definition
SELECT ssot__Account__dlm.ssot__Name__c AS CustomerName__c Extracts a customer's name from the Account object and assigns the name an alias CustomerName__c.
Vehicle_Sales_Detail__cio.CustomerId__c AS CustomerId__c Extracts the customer's unique ID from the Vehicle Sales Detail calculated insight and assigns it an alias CustomerId__c.
SUM(Vehicle_Sales_Detail__cio.DealerSalesAmount__c + Vehicle_Sales_Detail__cio.DirectSalesAmount__c + Vehicle_Sales_Detail__cio.PartsTxnAmount__c + Vehicle_Sales_Detail__cio.RepairOrderAmount__c) as TotalAmount__c Calculates the total revenue generated for each customer from various sales activities such as dealer sales of vehicles, direct sales of vehicles, parts sales, and repair orders from the Vehicle Sales Detail calculated insight. The value is assigned an alias TotalAmount__c.
FROM Vehicle_Sales_Detail__cio Specifies the Vehicle Sales Detail calculated insight that the total amount is derived from.
JOIN ssot__Account__dlm ON (Vehicle_Sales_Detail__cio.CustomerId__c = ssot__Account__dlm.ssot__Id__c ) Joins the data in the Vehicle Sales Detail calculated insight and Account object by matching the Customer ID field on Vehicle Sales Detail to the ID field on Account.
GROUP BY CustomerName__c, CustomerId__c Groups the results based on the customer's name and ID, and applies the SUM aggregation function to calculate the total revenue for each customer.