Calculated Insight: Vehicle Revenue From Repair Orders

The Vehicle Revenue From Repair Orders calculated insight aggregates the lifetime revenue generated from services, repairs, and maintenance activities for a specific vehicle. The vehicle revenue from repair orders considers the services done by both the original equipment manufacturer and the dealerships.

Required Editions

Available in: Enterprise, Unlimited, and Developer Editions

Here’s a breakdown of the logic.

Expression Description
SELECT SUM(ssot__WorkOrder__dlm.ssot__TotalPriceAmount__c) AS RepairAmount__c, ssot__Vehicle__dlm.ssot__VehicleIdentificationNumber__c AS VIN__c Applies the SUM aggregation function to the Total Price Amount field in the Work Order object and assigns it an alias RepairAmount__c. Extracts the Vehicle Identification Number field from the Vehicle object and assigns it an alias VIN__c.
FROM ssot__WorkOrder__dlm JOIN ssot__WorkOrderItem__dlm ON ssot__WorkOrder__dlm.ssot__Id__c = ssot__WorkOrderItem__dlm.ssot__WorkOrderId__c Joins the data in the Work Order and Work Order Item objects by matching the Work Order ID field on the Work Order Item object to the ID field on the Work Order object.
JOIN ssot__Asset__dlm ON (ssot__WorkOrder__dlm.ssot__AssetId__c = ssot__Asset__dlm.ssot__Id__c) Joins the data in the Asset and Work Order objects by matching the ID field on the Asset object to the Asset ID field on the Work Order object.
JOIN ssot__Vehicle__dlm ON (ssot__Asset__dlm.ssot__VehicleId__c = ssot__Vehicle__dlm.ssot__Id__c) Joins the data in the Asset and Vehicle objects by matching the Vehicle ID field on the Asset object to the ID field on the Vehicle object.
GROUP BY VIN__c Groups the results by VIN__c, aggregating the revenue from repair orders for each unique vehicle.