• Davide Gammone
  • 0 Points
  • Member since 2014
  • Salesforce Technical Manager
  • Atos

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
  • 6
   I want to display the week number based  on quartrly of the year Please suggest me how to display
   Below is the image how it should be displayed
   User-added image

I wrote a formula which is giving quarter correctly but the week number is not displayed correclty
CASE(MONTH( CloseDate ),1,"Q4",2,"Q1",3,"Q1",4,"Q1",5,"Q2",6,"Q2",7,"Q2",8,"Q3",9,"Q3",10, "Q3",11,"Q4",12,"Q4","None")& "-W"&Text(CEILING( 
DAY( CloseDate ) + 
MOD( DATE( YEAR( CloseDate ), MONTH( CloseDate ), 1 ) - DATE( 1900, 4, 1 ), 7 ) 
) / 7 

I need to display the weekly based on the image attached Please suggest me how to modifiy the formula.


Hi Guys.

I am trying to have a formula field for the Week Number of the year. So, if opportunity is created on the 3rd January 2016, it would show "Week 1 2016".
I use the report in the Matrix format.
Currently, the field I am using for week number calculation is called "Created Date"
Format of the field is: DD/MM/YYYY (this was changed in the regional settings from the american MM/DD/YYYY format)

I have browsed forums and found many formulas... which none of them work.
One of them, for example:

MOD(FLOOR((Created_Date__c - DATEVALUE( "2016-01-01 " ) ) / 7 ), 52) + 1

It gives me the following error:
Error: Invalid custom summary formula definition: Field Created_Date__c does not exist. Check spelling.

Now, I am new in SFDC formulas, so as far as I understand, there is no such field. It should be called Crated Date. But if i use just Created Date - I get error that there is no field Created. If I use formula like this:

MOD(FLOOR(("Created Date" - DATEVALUE( "2016-01-01 " ) ) / 7 ), 52) + 1

I get error: Error: Invalid custom summary formula definition: Incorrect parameter type for operator '-'. Expected Number, Date, DateTime, received Text.

I know that I am doing mistake somewhere, but where?
Thank you for the answers!

I am trying to create a field that displays week of the year that the lead was created based off the CreatedDate (Date/Time) Field.

I think I need to first convert the CreatedDate (Date/Time) to a (Date) field and then use a formula to change the date into a Week Number.

The output of the formula should be a number (between 0-52).

This is what I'm working with right now... but this formula has errors:

DAY( DATEVALUE( date/time ))
  CEILING( ( date - DATE( YEAR( date ), 1, 1) + 1) / 7) > 52,
  CEILING( ( date - DATE( YEAR( date ), 1, 1) + 1) / 7)

Any help would be greatly appreciated! 



I am trying to gather the week number of a week within a fiscal year. I have been able to calculate this for the standard 52-week year using the following formula:


MOD(FLOOR( ( CloseDate -DATEVALUE("YYYY-MM-DD"))/7),52)+1


My issue is that i need to now calculate the fiscal week for a fiscal year that has 53 weeks. 


Thanks for the help.

In Sweden and some other parts of Europe the week numbering is often using the ISO 8601 standard that says that the first week of the year is the first week with at least 4 days in the new year. Some consequences of this is that the final dates of one year can be week 52, 53 or even week 1( in the following year). The same goes for the first dates of a year.


To be able to do weekly comparison report Year-to-Year with this weeknumbering it is necessary to create custom fields for the opportunity that calculates the Year and Week number for a given close date. Here is one solution using three custom formula fields.


Field: Global Sales Report Weekday

Description:  Day 1 = Sunday, 2 = Monday....., 7=Saturday

Formula:  MOD( CloseDate  - DATE(1900, 1, 7), 7)+1


Field: Global Sales Report Week Year

Formula: YEAR(CloseDate + (MOD(8- Global_Sales_Report_Weekday__c ,7)-3))


Field: Global Sales Report Week


FLOOR((CloseDate - DATE( Global_Sales_Report_Week_Year__c ,1,1) +
(MOD( DATE(Global_Sales_Report_Week_Year__c,1,1) - DATE(1900, 1, 7), 7)+1)
+1,7)-3) / 7 + 1)


Hope this can be of use for anyone else


Peter Baeza

InfoAction AB, Sweden


  • March 15, 2010
  • Like
  • 3

I am a bit of a beginner at formulas, so hopefully one of you will think this is easy, and be able to help. :-)


Customer requirement:


Create a formula field that displays the Week Number (as Week 1, Week 2, etc), based on the Date entered on a particular record (same object).


Ex: 01/01/09 - 01/04/09 would return a value of "Week 1"  

01/05/09 - 01/11/09 = Week 2

01/12/09 - 01/18/09 = Week 3


and so on.....


Is using the CASE function the way to go, and if so, what's the shortest way to create this formula?


Thank you in advance!



  • April 20, 2009
  • Like
  • 0
My developer has created a custom class to extend the datasource.connection class and when he hits SAVE, gets the followin error message:

EROR: Compile Error? Type not visible: DataSource.Connection at line 5 column 15.

Line 5 states:
global class  TestUserDataSourceConnection extends DataSource.Connection {

Problem at botton says: Line 5 Type is not visible: DataSource.Connection

Any ideas what may causing the error?