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
vishnu nvvishnu nv 

How to calculate No. of days in Specific Stage

Hi, 
  I have used below SOQL query for calculating the No of days in the stage.

SELECT name, StageName from opportunity WHERE isClosed=false AND ((StageName ='Validate' AND Id in (SELECT opportunityId from opportunityHistory WHERE StageName ='Validate' AND CreatedDate=LAST_N_DAYS:20)) OR (StageName ='Connect' AND Id in (SELECT opportunityId from opportunityHistory WHERE StageName ='Connect' AND CreatedDate=LAST_N_DAYS:20)) OR (StageName ='Negotiate' AND Id in (SELECT opportunityId from opportunityHistory WHERE StageName ='Negotiate' AND CreatedDate=LAST_N_DAYS:20)))

But its not working , as it has some limitations. 

Can you please help
VinayVinay (Salesforce Developers) 
Hi Vishnu,

Check similar references below.

https://salesforce.stackexchange.com/questions/376866/how-to-calculate-report-on-the-time-between-two-specific-stages
https://developer.salesforce.com/forums/?id=9062I000000IEY1QAO

Thanks,