SSAS 2008 with Adventure Works

  • I'm working on setting up a 2008 SSAS database using Visual Studio 2008. We have AdventureWorksDW2008R2 as our database in SQL Server 2008 R2. We created a cube in VS 2008 and brought in the dimension "Dim Date" with the fact table called "Internet Sales".

    We can deploy no problem but the issue is when we try to build attribute relationships. When we build this relationship, it works fine:

    Date Key --> Full Date Alternate Key --> English Month Name --> Calendar Quarter --> Calendar Semester

    The moment we add Calendar Year, it fails saying: "Errors in the OLAP storage engine: A duplicate attribute key has been found when processing: Table: 'dbo_DimDate', Column: 'CalendarSemester', Value: '2'. The attribute is 'Calendar Semester'."

    Date Key --> Full Date Alternate Key --> English Month Name --> Calendar Quarter --> Calendar Semester --> Calendar Year

    Where are we going wrong? We're having issues with this duplicate error in almost every other attribute relationship we setup. We created a different attribute relationship for our Customer dimension for Gender and Martial Status and we got the exact same issue - except duplicate value in Martial Status is (S).

    We are creating the relationships because we intend to setup hierarchies. The hierarchies work fine without the relationships so we are a bit perplexed.

    Here is what we've checked:

    1.) Quarter, Semester and Year contain NO NULLs

    2.) Quarter, Semester and Year do duplicate (as we'd expect for each date). What is wierd is why does it work without Year in the relationships but it works with Semester & Quarter?

    Where are we going wrong here?

  • The problem is that semester is not unique for each year.

    "What?", do you think, "has he gone out of his mind?"

    The answer is yes, but that's besides the point.

    When you look at the actual values for semester, you'll find 1 and 2.

    If you look at semester 2, you have no way of telling to which year it belongs.

    That's because semester 2 occurs in every year. Hence the duplicate key error.

    The trick is to change the key for semester. When you look at the properties of the semester attribute, somewhere at the bottom you have the key column.

    This is default the attribute semester itself. Change this to year + semester. This will garantee to be unique.

    Change the name column to semester. This can sometimes be confusing (as you have the same 2 values for each year), so most of the time a calculated column is used for the name column. For example "Semester Friendly", with values like "2013 S02".

    You would use this attribute to compare the semesters of each year with each other. For example: "How was the sales in semester 1 of 2013 compared with the sales of semester 1 in 2012?"

    You can also keep an attribute like you originally had (just semester 1 and 2). This can be used for analysis: "How does semester 1 compares with semester 2 over all the years?" You just cannot use it in an attribute hierarchy with year.

    Typically they give different names to those attributes: "semester" and "semester of year".

    You have the same issue with weeks, months and quarters.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Thanks so much for the detailed explanation, it worked like a charm. From a usability standpoint, I'm disappointed that it is so complex to implement but I now understand the situation much better. Thanks again.

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

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