Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Career advice for the IT professional
Browse by Tags · View All
SQLServerPedia Syndication 194
SQL Server 60
SSAS 40
#SQL SERVER 19
SSIS 18
2012/Denali 17
Career 17
Denali 14
SQL Server 2012 13
MDS/MDM 12

Archive · View All
June 2011 20
August 2011 15
July 2011 15
March 2012 15
October 2011 14
September 2011 14
May 2011 13
November 2011 12
February 2012 11
April 2012 10

James Serra's Blog

Many-to-Many Dimensions

Nov 14 2011 12:00AM by James Serra   

In SSAS, data structures do not always conform to the snowflake or star schema model where one fact is associated with a single dimension member.  For example, consider the example of financial transactions in accounts that can have one or more customers. This can be modeled as:

The relationship between transaction and customer is a many-to-many relationship.  A single transaction can be associated with many customers and each customer can be associated with many transactions.  For example, I can have an individual account as well as a joint account with my wife.  So a single transaction in our joint account means that transaction is associated with many customers (my wife and I), and each customer (me) can be associated with many transactions (all my transactions for my individual account and my joint account).

In the example picture above, there are two dimensions and two fact tables.  The Customer dimension is the Many-to-Many (MM) dimension to the Transaction fact table.  The Customer Account measure group is the Intermediate Fact Table (called a bridge table in the relational world) and Account is the intermediate dimension.  The intermediate fact table is the fact table that relates the Many-to-Many dimension to the regular dimension.  In this case, it relates the Customer dimension to Account dimension.  The transaction fact table is related to Customer in the conventional manner, but is also related to the Customer dimension via a many-to-many relationship.

More info:

Many-to-Many Dimensions in Analysis Services 2005

Dimension Relationships

The Many-to-Many Revolution 2.0

Analysis Services Many-to-Many Dimensions: Query Performance Optimization Techniques


Republished from James Serra's Blog [70 clicks].  Read the original version here [32134 clicks].

James Serra
35 · 5% · 1664
0
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

3  Comments  

  • This looks to be inappropriately modeled.

    It looks like you have applied Third Normal Form rules to an OLAP database. Analysis Services is not built to support 3NF databases (although it can be convinced to do so).

    When creating OLAP databases, all joins should terminate on the fact table(s). The only exception to this rule are snowflakes, where dimension hierarchies are modelled using multiple dimension tables.

    In your example:

    So a single transaction in our joint account means that transaction is associated with many customers (my wife and I), and each customer (me) can be associated with many transactions (all my transactions for my individual account and my joint account).

    This will not aggregate properly at the Customer level (although it may aggregate properly at the Account level). Every deposit will be counted twice (one for you, one for your wife) and ever debit will be counted twice when going across the dimension Customers. When your balance is something other than 0, it will be doubled.

    Example: Action: You deposit $100 into your joint account. Result: You have a balance of $100, your wife has a balance of $100, for a total of $200.

    Action: Your wife writes a check for $50, which is presented and honored. Result: You have a balance of $50, your wife has a balance of $50, for a total of $100.

    This can be made to work using the materials you referenced above, but the initial sub-optimal design will cause huge amounts of work, headaches and performance issues down the road.

    commented on Nov 25 2011 9:33AM
    Marc Jellinek
    97 · 2% · 545
  • Hi Marc,

    Thanks for your reply. You bring up some good points, which are addressed in more detail in the first link in my post "Many-to-Many Dimensions in Analysis Services 2005". As it says, "The sum for all amounts is not the sum of the individual amounts for each customer—that would double-count the data that John and Jane share. Instead, the total amount is the sum of all transactions". So that answers your point about doubling the totals. It also goes into detail on how to model it in SSAS, so I'm confident the model above is correct. Please look over that link and let me know if you disagree. Again, thanks for your input.

    commented on Nov 25 2011 3:02PM
    James Serra
    35 · 5% · 1664
  • I have come up with one of the scenario where you have different attribute on a table and have many to many relationship. Lets take above example and add one more columns sex in customer dimension and then add related attribute in cusotmer dimension of SSAS. After processing the cube browse the cube based on sex and check the fact count or amount, it will give you improper result. It can be very well handle in SQL Database using inner join but how can we handle this scenario in SSAS?

    commented on Sep 3 2012 4:56AM
    rajlama
    2703 · 0% · 3

Your Comment


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]