Date Function 4-4-5 Week Quarter

  • I am trying to get some ideas on how to calculate a rolling 4-4-5 Week Quarter.  Any Ideas? 

    Sample Dates:

    Sept= Aug 28th

    Oct= Oct 2nd

    Nov= Oct 30th

  • Try the following

    select datepart(wk,'20060812')

  • --QuarterOfYear

    Set DateFirst 6

    Select (DatePart(wk, getDate())/13) + 1 as QuarterOfYear

     

    I did this to know the Quarter of the Year I am in.  I have to pass a function Today's Date (getDate()).  So do I have to calculate the quarter to get the first day of the 4-4-5??

  • Create a function to return the quarter based on the date input

  • For Fiscal Calender calculation the way I had handled was building a calender table and autopopulate it once a year (as soon as Fiscal Calender is created by finance). The reason was there could be 53 Week Year

    Create table tbl_Calendar

    (

     dt_DOB datetime,

     i_FiscalYear int,

     dt_FiscalYearBegin datetime,

     dt_FiscalYearEnd datetime

     i_FiscalMonth int,

     dt_FiscalMonthBegin datetime,

     dt_FiscalMonthEnd datetime,

     dt_WeekBegin datetime,

     dt_WeekEnd datetime

    )

     Once you know the Fisacal Year Begining you can auto populate it and use it later.

    Hope this helps.

    Thanks

    Sreejith

     

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply