• sushil_dwid (10/6/2015)


    Hi ,

    I have query on grouping data on weekly basis..

    1. Week should start from Monday to Sunday

    2. It should not consider current week data(suppose user clicks on report on Tuesday, it should display the data for last week).

    3. I want output like below

    Week1,week2,week3..... week12,AverageofWeek

    12 , 10 ,0.........0 12

    Could you please help on this

    Should be straightforward. Can you post up a sample data script please?

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden