Salesforce stores the current state of an opportunity, so filtering today’s records to last month’s dates does not show last month’s pipeline. To rebuild a past date, take the latest OpportunityHistory row per opportunity at or before that date, and use OpportunityFieldHistory for tracked fields such as owner. Scheduled reporting snapshots capture more fields going forward but cannot recover the past. Each source has its own retention and coverage limits, so state which one an as-of number came from.
The query that looks right
Someone asks what open pipeline looked like on July 1. The obvious SOQL filters Opportunity on IsClosed = false and a close date range. You get a clean number, and it describes today. A deal that closed last week has dropped out, a deal created yesterday may have come in, and a close date pushed out of the quarter takes its amount with it.
Synthetic example: a team reports 4.2M of open quarter pipeline on July 1. Running the naive query on August 1 returns 3.6M for the same quarter. That 0.6M gap is made of wins, losses, pushed dates and amount edits, and the query can’t show you the mix. Worse, readers will assume pipeline shrank by that much in the period under review.
Every pipeline answer has two dates in it. One is the period the close dates fall into. The other is the observation date, the moment you’re looking from. Most disputes about pipeline numbers come from two people holding different observation dates without either having said so.
Where Salesforce keeps the past
Salesforce gives you three separate records of the past, and they differ in what triggers a row, which fields are covered and how long the data lasts. Pick by the question in front of you. Before you promise anyone a backfill, check what your org has turned on.
- OpportunityHistoryThe stage history object. A new row is written when Amount, Probability, Stage or Close Date changes, and admins cannot choose what it tracks. Salesforce Help says opportunity stage history is not automatically deleted, unlike field history on other objects.
- OpportunityFieldHistoryA change log for the fields an admin selected, with Field, OldValue, NewValue and CreatedDate. Without Field Audit Trail, field history is retained for up to 18 months and up to 24 months through the API. It only starts from the day tracking was switched on.
- Reporting snapshotsA scheduled copy of a source report into a custom object. It can hold any mapped column, including ones no history object covers. Each run can add at most 2,000 records, and rows past the cap are not recorded. It captures nothing from before the first run.
- Historical trend reportingKeeps the previous three months plus the current one. Salesforce documents up to 12 months of opportunity history when Historical Trending is enabled in Pipeline Inspection, with a cap of 5 million rows per object.
Rebuilding a past date with SOQL
For amount, stage and close date, latest row wins. Pull every history row at or before the as-of timestamp, sort newest first within each opportunity, and keep the first row you see for each OpportunityId. Then apply your open-stage list and your close date range to those reconstructed values in your application, because the live Opportunity row may have changed since.
SOQL has no window functions, so the dedupe happens outside the query. Treat the as-of timestamp as a decision too. CreatedDate on these rows is a datetime, and a review held on July 1 in Sydney starts many hours before one held in Chicago.
Open or closed is a property of the stage label at that time, so keep a dated copy of your stage list. Rename a stage in March and every earlier row carries the old label. A filter on the current picklist drops them without a word.
SELECT OpportunityId, CreatedDate, StageName, Amount, CloseDate
FROM OpportunityHistory
WHERE CreatedDate <= 2026-07-01T00:00:00Z
ORDER BY OpportunityId, CreatedDate DESC
-- In your application: keep the first row per OpportunityId,
-- then filter on your open stages and close date range.Four edge cases to test first
Run the reconstruction for a date on which you already hold an exported report, then chase every difference down to a record. I wouldn’t trust the rebuild until that’s done. A handful of known cases account for most of what you’ll find.
- No row before the as-of dateThe object reference says a query returns nothing when none of the four fields have changed. Check how your org represents an opportunity that was never edited, and compare against Opportunity.CreatedDate so never-edited deals are not lost.
- Owner and regionOpportunityHistory doesn’t give you the owner at the time. A review by rep needs tracked OwnerId changes from OpportunityFieldHistory, and an owner change driven by a parent record has a Salesforce known issue where NewValue can hold the old ID. Sample some.
- Text in NewValueSalesforce notes that field history captures numeric changes as text. Parse amounts deliberately and decide what you do with a value in another currency or format.
- CurrencyA grouped SUM(Amount) returns the org default currency and cannot be wrapped in convertCurrency(). With advanced currency management, opportunity history conversion uses dated rates, so a rebuilt figure may differ from a report using another rate.
Explaining movement between two dates
Once two as-of states exist, compare them opportunity by opportunity and put each difference in exactly one bucket. Use a fixed precedence so a deal that was both pushed and resized lands in one place. Write the precedence down, since it changes the size of every bucket.
Synthetic example, on the same quarter: 4.2M open on July 1 becomes 3.6M open on August 1. Closed won removes 0.5M, closed lost removes 0.3M, dates pushed out of the quarter remove 0.6M, amount edits remove 0.1M, and new or pulled-in deals add 0.9M. Those five lines sum to the 0.6M decline. A bridge that doesn’t foot has a classification bug.
The bridge states what moved and leaves out why. A pushed date can be a healthy procurement delay or an unqualified deal, and no field in the record distinguishes them. For that conversation, the push count on Opportunity makes a good companion signal. Salesforce describes it as counting calendar months a close date has moved out.
| Synthetic bucket | Amount | Rule |
|---|---|---|
| Open on July 1 | 4.2M | Reconstructed from history |
| Closed won | -0.5M | Checked first |
| Closed lost | -0.3M | Checked second |
| Pushed out of quarter | -0.6M | Still open, date now outside |
| Amount changed | -0.1M | Still in, difference only |
| New or pulled in | +0.9M | Not in the first state |
| Open on August 1 | 3.6M | Must equal the second rebuild |
A setup you can finish this week
Check that OwnerId and your segmentation fields are tracked, because field history can only start from today. Schedule one weekly snapshot of open pipeline, with a filter that keeps it under the 2,000 row cap per run, or several filtered reports if one won’t fit. Read the run history, where rows past the cap show up as failures. Salesforce limits stored runs to 200, and target objects cannot have validation rules, workflows or Apex insert triggers.
Export the first as-of rebuild next to a report your team already accepted for that date. Keep one deal whose close date moved between two meetings as the example you show people. It explains the topic faster than any definition.
How we treat the observation date
We run a Salesforce question under the asker’s sign-in, so sharing rules and field-level security decide which opportunities appear. The generated SOQL sits on the answer, with filters applied, tables used and what was left out. A reader can see whether a pipeline figure came from live Opportunity rows or a history object, edit how the question was read, and run it again.
Test us on that. Ask one current-state question and one as-of question, then check whether the second came from history or from today’s records with a date filter.
Bring three business questions
Explore your sources, definitions, and review criteria with our team. Please keep credentials and sensitive records out of the inquiry.