+ Start a Discussion
aks001aks001 

Calculate week of the month

Hi,

 

I'm trying to calculate the week of month nd m failing with this approach.

 

MOD(FLOOR((StartDate__c - DATE(YEAR(StartDate__c),1,1)/7) + 26,52)+1)

 

what I actually want is suppose if I have 52 records created with the start date and end dates like.. 1st... 1/1/2014 to 8/1/2014. 2nd ... 8/1/2014 to 15/1/2014 and so on....

so I want to calculate that what is the number of week like.... 1st week , 2nd week and so on....

 

if anyone has the solution for this than please let me know .............. thanks in advance..... :)

Best Answer chosen by Admin (Salesforce Developers) 
AgiAgi

Hi,

it shows the Week of the Month the Date is in:

CEILING( (StartDate__c - DATE( YEAR( StartDate__c ), Month(StartDate__c), 1) + 1) / 7)

All Answers

AgiAgi

Hi,

it shows the Week of the Month the Date is in:

CEILING( (StartDate__c - DATE( YEAR( StartDate__c ), Month(StartDate__c), 1) + 1) / 7)

This was selected as the best answer
aks001aks001
Hi,

thanks it's working now.