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
dcwdcw 

Formula: Day of Quarter

I want to create a formula field that derives the forecast for the previous 365 days from a quarterly forecast.  I currently do this in SQL Server by pro-rating the current quarter and last years quarter to determine the amount of these quarters to include.  To do this I need to determine number of days consumed/remaining in the quarter.  How can I ask the "What is the day of the quarter?" in SFDC.

 

My SQL Server code is:

,(       @DayOfQtr /92.0 * case @qq when 1 then F.CYQ1 when 2 then F.CYQ2 when 3 then F.CYQ3 when 4 then F.CYQ4 END)
+                                   case @qq when 1 then F.PYQ4 when 2 then F.CYQ1 when 3 then F.CYQ2 when 4 then F.CYQ3 END
+                                   case @qq when 1 then F.PYQ3 when 2 then F.PYQ4 when 3 then F.CYQ1 when 4 then F.CYQ2 END
+                                   case @qq when 1 then F.PYQ2 when 2 then F.PYQ3 when 3 then F.PYQ4 when 4 then F.CYQ1 END
+((92-@DayofQtr)/92.0 * case @qq when 1 then F.PYQ1 when 2 then F.PYQ2 when 3 then F.PYQ3 when 4 then F.PYQ4 END)
   as P365_Fcst__c