function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
gaurav.sfdcgaurav.sfdc 

Opportunity as seen at start of some previous period

I have a statement to calculate Win Rate :"Win Rate is calculated by adding total revenue closed within the period divided by total revenue in open opportunities at the start of the period" Period is some past period say a month period say start date '01-Aug-15' to '31-Aug-15'
Now if Opp is created in July month end say 26th-July-15, How can I get Amount value at start of the period. (Here 1st-Aug-15). In OppHistory we have an entry of 26th-July. I understand the business here, when period started what is the value of amount of Opp vs at end of period. I think the best way could be
Amount from oppHistory where created date between opp.createddate and 1st-Aug-16(inclusive) desc oppHistory created date limit 1.
This will give any value of amount modified near or at 1
Just wanted to have others opinion.