DLRS and Rollup Fields
How declarative lookup rollups, formulas, summary fields, and service-maintained totals work in reports
Many report fields in this project are not typed by a user. They are calculated from child records, formulas, scheduled jobs, Apex services, or DLRS.
Understanding that difference matters. If a user filters on the wrong rollup, the report can look correct but answer the wrong question.
What DLRS Means
DLRS means Declarative Lookup Rollup Summaries. It is a managed package/tooling pattern that keeps rollup fields on a parent record when the relationship is a lookup, not a Salesforce master-detail relationship.
Plain English:
Example: Sales Order Lines are child records of a Sales Order. A DLRS rule can count lines, sum line revenue, sum commission, or find the largest line revenue, then write the result onto the Sales Order.
Why Users See Rollup Fields
Reports are easier when users can filter or group on the parent record. A Sales Order report can show Total Commission Amount, Line Item Count, Total Units, or Negative Margin Lines without requiring every user to build a line-item report.
That convenience has a tradeoff: the report user must know what child records and criteria feed the field.
Rollup Types In This Project
| Type | Example | What updates it | Report behavior |
|---|---|---|---|
| Formula | AR Status, Order Gross Margin, BOM Cost Coverage %. | Salesforce calculates from other fields on the same record. | Good for labels and ratios. |
| Salesforce summary field | Total Order Revenue where metadata type is Summary. | Native Salesforce rollup on a supported relationship. | Good for parent totals. |
| DLRS rollup | Line Item Count, Total Commission Amount, address order counts. | DLRS custom metadata rules. Most active rules in this repo are realtime. | Good for parent summaries; check child object and criteria. |
| Apex/service rollup | Payment totals, fulfillment summary, Lead activity summaries. | Domain services/triggers/schedulers. | Good for operational state; check the owning service if stale. |
| Snapshot | Billing/shipping address fields on orders and payment transactions. | Copied when the record is created or workflow runs. | Good for historical reporting. |
How To Spot A Rollup Field
Field names often reveal the pattern.
| Name pattern | Usually means |
|---|---|
Total *, * Total, * Amount | Sum or calculated amount. |
* Count | Count of child records or related evidence. |
Last *, Latest *, First * | Max/min timestamp from related records or latest service state. |
* Percent, * Ratio, * Rate | Formula derived from totals. |
Has *, Is * | Formula or service-maintained checkbox. |
* Status, * Tag, * Rating, * Tier | Derived operational label. |
Metrics * | System/debug evidence for recalculated metrics. |
Sales Order DLRS Fields
These Sales Order fields are backed by Sales Order Line rollups or line-derived summary logic. They are good for order-level reports, but use line reports when you need the exact item that caused the value.
| Sales Order field | Child source | What it means |
|---|---|---|
Line Item Count | Sales Order Lines | Count of all custom sales-order lines. |
Total Units | Sales Order Lines | Sum of line quantities. |
Total Order Cost | Sales Order Lines | Sum of total line cost. |
Total Commission Amount | Sales Order Lines | Sum of line commission amounts. |
Total Credits Amount | Sales Order Lines where credit item flag is true | Sum of credit-line revenue. Usually negative. |
Total Line Net Margin | Sales Order Lines | Sum of line net margin. |
Total COGS Variance | Sales Order Lines | Sum of line COGS variance. |
BOM Lines Count | Sales Order Lines using BOM cost | Count of BOM-backed lines. |
BOM Covered Line Count | Sales Order Lines with BOM-backed cost basis | Count of cost-covered lines. |
High Margin Items Count | Sales Order Lines in high-margin bucket | Count of high-margin lines. |
Low Margin Items Count | Sales Order Lines in low-margin bucket | Count of low-margin lines. |
Negative Margin Lines | Sales Order Lines with negative margin | Count of loss-making lines. |
Largest Line Revenue | Sales Order Lines | Revenue from the largest single line. |
Items At Max Tier | Sales Order Lines | Count of lines already at maximum commission tier. |
Items With Opportunity | Sales Order Lines | Count of lines with a commission-tier opportunity/nudge. |
Lines With No Config Count | Sales Order Lines | Count of lines missing commission/cost config. |
Lines With Overrides Count | Sales Order Lines | Count of lines with manual commission overrides. |
Total Potential Additional Commission | Sales Order Lines | Sum of possible additional commission from lines with tier opportunities. |
Best practice: use these fields to find orders that need review. Use Cost Intelligence Sales Order Lines when you need item-level accountability.
Address Tracker DLRS Fields
Address Tracker records use DLRS to summarize order and quote behavior by bill-to and ship-to address.
| Address field family | Child source | What it answers |
|---|---|---|
Bill To Order Count / Ship To Order Count | Sales Orders | How often this address was used on orders. |
Bill To Order Value / Ship To Order Value | Sales Orders | Total final order value for this address. |
Ship To Order Units | Sales Orders | Units shipped to this address. |
Ship To Shipment Count | Sales Orders | Shipment count for this ship-to address. |
Last Bill To Order Date / Last Ship To Order Date | Sales Orders | Most recent order date for the address. |
Last Ship To Delivery Date | Sales Orders | Most recent complete delivery timestamp. |
Last Ship To Fulfillment Sync | Sales Orders | Most recent fulfillment sync date. |
Bill To Quote Count / Ship To Quote Count | Quotes | Quote count by address. |
Bill To Quoted Value / Ship To Quoted Value | Quotes | Quoted value by address. |
Converted Quote Count fields | Converted Quotes | Quotes tied to a converted order. |
Best practice: use Address Tracker rollups for address-level questions, such as "which stores/ship-to locations generate the most value?" Do not use them to inspect individual order issues.
Account DLRS Fields
Account rollups summarize customer behavior across quotes, orders, credits, ownership transfer, and lifetime value.
| Account field family | What it answers |
|---|---|
| Quote count/value fields | How much quoting activity exists for the customer. |
| Converted quote fields | Which quote value turned into orders. |
| Lifetime spend | Customer-level sales value. |
| Credit fields | Shipping, goodwill, pricing adjustment, damaged product, post-audit, and unclassified credit totals. |
| High/low margin order counts | Whether the customer tends to produce good or weak margin. |
| Last quote/credit/ownership transfer date | Recency of activity. |
| Ownership transfer count | Handoff volume. |
Best practice: use Account rollups for customer portfolio reports. For individual order, item, or credit investigation, open the underlying records.
Quote Rollup Fields
Quotes use rollups from Quote Lines for approval, margin, and conversion readiness.
| Quote field family | What it answers |
|---|---|
Line Item Count | Number of quote lines. |
Gross Amount, Total Credits Amount, COGS, Gross Margin | Quote economics. |
Total Commission Amount, Total Line Net Margin | Commission and margin context before conversion. |
BOM Line Count, Lines With No Config, Lines With Overrides | Setup quality and cost confidence. |
Items At Max Tier, Items With Opportunity | Commission-tier opportunity. |
Negative Margin Line Count | Approval risk. |
Best practice: use quote rollups for approval and pre-order profitability. Use quote line reports when you need item detail.
Item DLRS Fields
Items use rollups to summarize sales velocity, revenue, COGS, and open order demand.
| Item field family | What it answers |
|---|---|
Sales Last 7/30/90/365 Days | Sales activity over rolling windows. |
Units Last 7/30/90/365 Days | Unit velocity. |
Revenue Last 30/90/365 Days | Revenue contribution. |
Avg COGS Last 30/90 Days | Recent cost trend. |
Open Orders Count | Current demand/backlog context. |
Allocated Units | Units already allocated. |
Best practice: use Item rollups for inventory, purchasing, and item-performance dashboards. Use order-line reports when you need exact order/customer evidence.
Staleness And Trust
Most DLRS rules in this repo are configured as realtime. That means the rollup should update when child records change. Still, users should understand these caveats:
| Symptom | What to check |
|---|---|
| Parent total looks wrong | Open the child records and confirm the rollup criteria. |
| Count is different from a detail report | The detail report may include records excluded by DLRS criteria. |
| Value is blank | No matching child records, missing child field values, or rollup not recalculated. |
| Field has old-looking data | Check whether the field is a snapshot, service-maintained metric, or archived legacy rollup. |
| Payment total does not match order total | Payment totals come from payment objects, not line revenue. |
Report Design Rules For Rollups
- Use rollup fields when the report question is about the parent record.
- Use child/detail reports when the question is about why the rollup has that value.
- Do not mix parent rollups and child rows without understanding row multiplication.
- Do not manually edit rollup fields.
- Treat archived legacy rollups as historical compatibility only.
- Add the owning child object and criteria to the report description when using a confusing rollup.
- If a dashboard uses a rollup, keep a drill-through report that shows the child records behind it.
Examples
| User wants to know | Use this | Drill into this |
|---|---|---|
| Which orders have negative margin? | Sales Order report with Has Negative Margin or Negative Margin Lines. | Cost Intelligence Sales Order Lines. |
| Which ship-to addresses drive the most revenue? | Address Tracker report with Ship To Order Value. | Sales Orders filtered by Shipping Address Tracker. |
| Which accounts receive the most credits? | Account report with credit rollup fields. | Sales Orders/lines or credit report filtered by Account. |
| Which items are selling fastest? | Item report with rolling sales/unit rollups. | Sales Order Lines filtered by Item. |
| Which orders are missing commission setup? | Sales Order report with Lines With No Config Count. | Sales Order Lines or Cost Intelligence Sales Order Lines. |
Last updated on