time range dimention based on a number

  • Hi

    I would like to create a time range dimention based on a numerical value.

    so I have a column in my fact table that represents the number of years and I would like the dimention to group the clumns to say <1 year, 1-2 years, 3-5 years, 6-10 years, etc

    is the only way to do this to create another table with a number field and a group field (as below)?

    Year Group

    0 <1 year

    1 1-2 years

    2 1-2 years

    3 3-5 years

    4 3-5 years

    5 3-5 years

    6 6-10 years

    thanks in advance

  • No. You could add a computed column for this. I recommend it be a persisted computed column to make it faster.

    --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)

  • I recommend a table that is then turned into a dimension. It will give you more flexibility to add/change things.

  • thanks a lot fellas, I understand the process now

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

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