Friday, September 1, 2006

Don't declare false Attribute Relationships [Reed]


It's really important to declare attribute relationships when they do exists. But what happens if you say A implies B when it isn't true. I somehow assumed that when you process the dimension, you'd get an error, but not so.


In the Adventure Works Date dimension, I created an attribute relationship from Day of Month to Day of Week. This is, of course, rediculous. Just because it's the 14th, that doesn't mean it's Wednesday. Just for fun, I then created a User Hierarchy of the same, with Day of Week drilling down to Day of Month. I got the nice, satisfying green triangle on the hierarchy. Then I deployed it.


As I said, I expected some kind of error or warning, but the days of the month just got a random weekday assigned. (I assume it has to do with the order the records were read from the dimension table.) So Sunday got associated with 12, 15, 18, and Monday with 1, 4, 21, 24, etc. This is actually the same behavior that AS2K had--if you created Day of Week as a member property of Day of Month, it would just pick one. I just thought 2005 would complain.


So, the moral is that you really really want to create attribute relationships when they are meaninful, but be careful not to create ones that are not, and don't trust silence as an indication of success.


-- Reed Jacobson