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
KartikeyKartikey 

formula applied on a text field doesnt give correct value

Hi, We have a formula running on a field "Expected Gross Revenue" in Opportunity screen. The formulae is something like:

((DATEVALUE(TEXT( YEAR(Today())) & "-12-31") - Operation_Start_Date__c + 1) / (DATEVALUE(TEXT(YEAR(Today())) & "-12-31") - DATEVALUE(TEXT(YEAR(Today())) & "-01-01")+1) ) *   Total_Gross_Revenue_Annual_c__c )

Ex: If a company's Annual Gross Revenue is 1,000,000 and my operation start date is 07 Sep 2009 then it should:

 

((2009-12-31) - (2009-09-07) +1) / 365 * 1,000,000

 

its approx : 317,808

 

But the field shows an incorrect value 158,904.11

 

The same field works fine for other users or even for me also for many opportunities.

 

Appreciate any help.

 

-Kartik

NikiVNikiV

Are you saying that this field shows the correct value for you on some Opps but not all, and for some users as well?  That is strange indeed.  You could try to break out the formula into different fields, and the final formula combines those fields - that way you can display all of the fields on the Opp to see what is happening. 

  • End_of_Year which is the DATEVALUE( TEXT( YEAR( Today() ) ) & "-12-31" )
  • Start_of_Year which is  DATEVALUE( TEXT( YEAR( Today() ) ) & "-01-01" )
  • Remaining_Days which is End_of_Year -Operation_Start_Date +1
  • Total_Days which is End_of_year - Start_of_Year +1
  • Final Total which is Remaining_Days / Total_Days * Total_Gross_Revenue field

 

That at least will show you the components and maybe you can see what is wrong.  You can delete the fields when you are done to clean it up.