• To be able to answer this question correctly, you need to tell us what a week, month, and quarter is.

    What day of the week does a week start on?
    What do you want done with months that don't have a whole week, especially the first and last weeks of any given year?
    Since years don't have a whole number of weeks, how do you want to handle that?
    What's a month?  Does it start on the 1st and end the day before the 1st of the next month or does it start and end based on your definition of a week?
    What's a quarter?  We all know the classic definition based on calendar days but that and the definition of what a month is all go flying out the window if you start talking about whole weeks.

    Or, does it even matter if weeks and months and quarters don't actually start on the same day of the week? 

    Or, have they really messed things up with a fiscal calendar?

    So, how do you want to define what week, month, and quarter is?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)