I need a Query for this (Bit Urgent)

  • Hi,

    I need a Query for calculating the fiscal_week based on the input dates (start_date and end_date), though I got a query from this forum, it is not giving me exact result.

    the sample is in the excel file with the attachment.

    In the excel:

    First tab tells you the raw_data what I am using to find the Fiscal_week

    Second tab tell you the data where i found the mistake, and how I am expecting the output.

    I also have attached the query I have got from this forum, query I have modified for fiscalweek

    kindly help me ASAP, as I need to produce the report Shortly.

  • If you want it urgently, then make it as easy as possible for someone to answer.

    Please provide the CREATE TABLE for all involved tables and the sample data as insert statements.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Gail,

    to be simple, all I need is to calculate the fiscal week. on a fiscal year.

    start day of a week is saturday and ends on Friday.

    the query i got is not giving the week numbers

  • whats the fiscal year start date......the excel sheet gives differing dates?

    FISCAL_DATE FISCAL_MONTH FISCAL_QUARTER Fiscal_Quarter_Short Fiscal_Year INTDATE Obtained_FISCAL_WEEK

    29/04/2006 2007M01 2007Q1 Q1 2007 20060429 WK1

    28/04/2007 2008M01 2008Q1 Q1 2008 20070428 WK1

    26/04/2008 2009M01 2009Q1 Q1 2009 20080426 WK1

    25/04/2009 2010M01 2010Q1 Q1 2010 20090425 WK1

    01/05/2010 2011M01 2011Q1 Q1 2011 20100501 WK1

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • Hi Livingston,

    thanks for your reply, but since it was little bit urgent, i fixed it manualy.

    anyway, 4th week's saturday of Each april from the year (calendar year) 2006 is the startdate, the excel contains dates from 2006 to 2023.

    so there will be 18 17 start and end dates.

    Thanks every one for your kind & valueable efforts.

    -Prabhu

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

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