Skip to content
Advertisement

How to implement dimension table design when having different values for the same dimension according to specific criteria?

If I have a Dimension Date table like this:

CREATE TABLE [Dimension].[Date](
    [Date Key] [int] IDENTITY(1,1) NOT NULL,
    [Date] [date] NOT NULL,
    [Day] [tinyint] NOT NULL,
    [Day Suffix] [char](2) NOT NULL,
    [Weekday] [tinyint] NOT NULL,
    [Weekday English Name] [varchar](10) NOT NULL,
    [Weekday English Name Short] [char](3) NOT NULL,
    [Weekday English Name FirstLetter] [char](1) NOT NULL,
    [Weekday Arabic Name] [nvarchar](15) NOT NULL,
    [Weekday Arabic Name FirstLetter] [nchar](1) NOT NULL,
    [Day Of Year] [smallint] NOT NULL,
    [Week Of Month] [tinyint] NOT NULL,
    [Week Of Year] [tinyint] NOT NULL,
    [Month] [tinyint] NOT NULL,
    [Month English Name] [varchar](10) NOT NULL,
    [Month English Name Short] [char](3) NOT NULL,
    [Month English Name FirstLetter] [char](1) NOT NULL,
    [Month Arabic Name] [nvarchar](15) NOT NULL,
    [Month Arabic Name FirstLetter] [nchar](1) NOT NULL,
    [Quarter] [tinyint] NOT NULL,
    [Quarter Name] [varchar](6) NOT NULL,
    [Year] [int] NOT NULL,
    [MMYYYY] [char](6) NOT NULL,
    [Month Year] [char](7) NOT NULL,
    [Is Weekend] [bit] NOT NULL,
    [Is Holiday] [bit] NOT NULL,
    [Holiday Name] [nvarchar](50) NOT NULL,
    [Special Day] [nvarchar](50) NOT NULL,
    [First Date Of Year] [date] NULL,
    [Last Date Of Year] [date] NULL,
    [First Date Of Quater] [date] NULL,
    [Last Date Of Quater] [date] NULL,
    [First Date Of Month] [date] NULL,
    [Last Date Of Month] [date] NULL,
    [First Date Of Week] [date] NULL,
    [Last Date Of Week] [date] NULL,
    [Lineage Key] [int] NULL,
 CONSTRAINT [PK__Date__B7A341C5SWWC2006D] PRIMARY KEY CLUSTERED 
(
    [Date Key] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO

I face the following problem:

Not all weekends and holidays are the same for all the organizational departments, There are default weekends(Fri,Sat) for example but some departments have different schedules so they have different weekend days. How to handle this situation when I have different values for the same dimension according to specific criteria? Should I create multiple versions for the same Dim? How to use Date Dim as a conformed dimension in an enterprise data warehouse in this case?

Advertisement

Answer

Having the Date dimension as a conformed table is adavntageous when :

  • One central location to update by ETL jobs
  • Easy to implement “Single Source of Truth” because the same copy of data is visible across organization.
  • Less data footprint due to removal of unnecessary copies of the same data.

In your case, you don’t need all the columns so you can have the DimDate table in your database but pointing to it with a simple view to get only columns you need. Also, you can have a bridge table between the DimDate view and the DimDepartment like below :

enter image description here

A logical data model may contain one or more many-to-many relationships. Physical data modelling techniques transform a many-to-many many-relationships into one-to many-relationships by adding additional tables. These are referred to as bridge tables.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement