At my company, we define the "launch date" as the close date of the first opportunity that belongs to an Account. So if an Account has 20 Opportunities, we find the first one, and use that close date as our launch date. Then we need to store that on the account.

I currently have some Apex that does this:

Account acc = [ SELECT Id, Name, Industry__c, LaunchDate__c from Account where Account.Id = :opp.AccountId  ]; 

Opportunity first_opp = [ SELECT Id, Name, CloseDate, AccountId,    StageName FROM Opportunity WHERE AccountId = :opp.AccountId and     StageName = 'Closed Done' ORDER BY closedate limit 1 ];

acc.LaunchDate__c = first_opp.CloseDate; 

update acc;

I'm curious if there is any way to convert this to a formula?

2 Answers 2


This is possible via Roll up summary field on Account object. Select roll up type as "Min" and field to aggregate as "Close Date" You can choose filter criteria as you want for example in you case you can put status ="Closed Done" as a filter criteria.

enter image description here

  • How do I connect this to the Opportunities? Commented Apr 3, 2023 at 18:27
  • @charlottesville That's why I included the dropdown on my own answer.
    – sfdcfox
    Commented Apr 3, 2023 at 19:10
  • Click on new field and choose roll up. There choose the summarized object as Opportunities.
    – Elijah
    Commented Apr 3, 2023 at 19:24

Formulas can't work on child records. However, you can create a Rollup Summary field to automatically calculate the earliest date:

Earliest Close Date Rollup Summary Field

  • I am impressed, I had same thought like great Mr fox. Great answer
    – Elijah
    Commented Apr 3, 2023 at 16:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .