dynamic generation of weeks for given months

  • i would like to get the report like marh to april weekly wise, SO i need to get the weeks seperation from 1st of march to 31 april. can any one have sample snippets. It's urgent.

  • I'm going to ask some questions to clarify the problem. All of the questions would be answered if you had posted the question using th emethod suggested in the top link in my signature.

    What is your table structure?

    Do you want data something like this?

    Month Week Sales

    ------ ---- -----

    March 1 1200

    March 2 900

    March 3 1000

    March 4 850

    What day do you want the week to start on?

    How do you want to handle it if the month starts/ends mid-week? Is that considered a full week?

  • Please don't cross post!

    I'd recommend to continue the thread on http://www.sqlservercentral.com/Forums/FindPost713955.aspx

    since it contains more input from the OP so far...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • Thanks for posting the link Lutz. Looks like I only wasted a little time on this thread.

  • I want the report like this.

    program name Jan(01/01-01/07) jan(01/08-01/14)......may(05/25-05/31)

    XXXXXX 78 54................. 23

    YYYYYY 12 45................. 33

    Where i struck is how do we consider the week. For example(what I have taken was 7 days considered as one week. In this case if some days left in a month, after considering 7 days as a week, in which month we have to put remaining days. (Let’s take an example if we take a January month, 4 weeks and 3 days are present. So In January 3 days are left, these three days in which month do we need to take, either January or February). If we considered the left days into January month, for the month of May I am getting 5 weeks. After that weeks and months were misplacing.

    Can you please let me know how do I proceed regarding the same?

  • week can be considered SUN-SAT. Please let me know if you need any more details

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

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