Search code examples
timessasolapbusiness-intelligencedimensions

How to fit a week into a calendar time hierarchy?


As is usual with cubes, the users want things that don't fit into a hierarchy to be displayed hierarchically. They'd like to see Day > Week > Month > Quarter > Year as the hierarchy, but the problem with weeks is they can be part of 1-2 months, not just 1 month (and by extension part of 2 quarters, semesters, years).

So my question is: how to set up the attribute relationships, and how to set up the hierarchy? Here is what I have, but I know it's not optimal.

Hierarchies (cycle == weeks):

hierarchies

Attribute Relationships:

attribute relationships There is no Cycle -> Year, because it is a many-to-many relationship


Solution

  • There are four types of weeks to concern yourself with:

    1. Week of Year (1-53). Hierarchy: Year > Week

      You should decide whether you want Week 1 to begin on Jan 1, or follow the ISO standard

    2. Week of Month (1-5). Hierarchy: Year [> Quarter] > Month > Week

      You should decide whether you want Week 1 to begin on the first day of the month, or the first Sunday/Monday of the month.

    3. Week of Fiscal Year (1-53). Hierarchy: Fiscal Year > Week

    4. Week of Fiscal Month (1-5). Hierarchy: Fiscal Year [> Quarter] > Month > Week