Sub topic 13
Stage history and pipeline reporting
This chapter assumes you know the Opportunity stage picklist, how stages set probability and forecast category, and how to build a basic report in Report Builder. Here you will report on where deals sit now and how they got there.
Two questions, two data sources
Pipeline reporting answers two different questions:
- Where are my open deals today? This reads the current values on the Opportunity record.
- How did this deal move over time? This reads the recorded changes in the opportunity history.
Mixing them up is the most common reporting error. A current-state report cannot tell you how long a deal sat in a stage.
Pipeline by stage
A pipeline report counts open deals and totals their amounts for each stage. In Report Builder, use the Opportunities report type. Filter to open opportunities, then group by Stage. In SOQL the same shape looks like this:
SELECT StageName, COUNT(Id) deals, SUM(Amount) total
FROM Opportunity
WHERE IsClosed = false
GROUP BY StageNameIsClosed is true for both Closed Won and Closed Lost, so IsClosed = false keeps only open deals. If you filter on stage names instead, you must update the report whenever you rename a stage.
A summary report grouped by Stage can also be shown as a funnel chart. The funnel orders stages by their position in the picklist, so a stage order that doesn't match your real process will make the chart misleading.
Reading a deal's stage history
Salesforce keeps a read-only history of changes to key opportunity fields such as stage, amount, and close date. You can see it in the Stage History related list on a record. You can also query the OpportunityHistory object. This query lists the changes for one opportunity in the order they were recorded:
SELECT StageName, Amount, CloseDate, CreatedDate
FROM OpportunityHistory
WHERE OpportunityId = '006XXXXXXXXXXXXXXX'
ORDER BY CreatedDateReplace the placeholder with a real record ID. Each row is a snapshot taken when one of the tracked fields changed. Subtracting the CreatedDate of one row from the next gives the time spent in the earlier stage.
For reports without code, use the Opportunities with History report type. It lets you filter and group on both current values and historical values, for example "deals that were ever in Negotiation/Review and ended Closed Lost".
Common errors
- Reading history as current data. A history row shows what a value was at that moment. The latest row may not match the record if a field changed in a way that was not recorded.
- Changing stage names without checking reports. Renaming a stage updates the picklist value on existing records, but filters that use the old name as text may stop matching. Check saved reports after any change.
- Expecting history to include bulk-loaded dates. Records loaded with a past Created Date do not have a realistic stage trail. Duration analysis is only reliable for deals that moved through stages in Salesforce.
- Forgetting that skipped stages leave no row. If a rep jumps from Prospecting to Closed Won, the middle stages have no history. Stage-based validation rules can prevent this.
Putting it together
A practical routine has three steps:
- Run the pipeline-by-stage report each week to see volume and value per stage.
- Open the Stage History of any deal that looks stuck or that changed a lot.
- Use an Opportunities with History report to find patterns across many deals, such as the stage where most lost deals were last seen.
Exercise
A manager wants to know how many days a closed-won deal spent in the Proposal stage. Which data source should you use, and why can't a standard "Opportunities by stage" report answer this?
Show answer
Use opportunity history (the Stage History related list, the OpportunityHistory object, or the Opportunities with History report type). Each history row records a stage with the date it was recorded, so the gap between the Proposal row and the next row gives the time in stage. A standard Opportunities report shows only the current stage, so it holds no record of past stages or dates.