Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Does it make sense store measures in a dimension table?


Does it make sense store measures in a dimension table?

Author
Message
Paul Hernández
Paul Hernández
SSC-Enthusiastic
SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)

Group: General Forum Members
Points: 173 Visits: 654
Hi everybody:

Right now I´m working in a BI solution and I received a set of tables with a multidimensional structure. I have a Fact table with transaction from customers and several dimensional tables. One of them is the KUNDE or customer table, in which the typical customer information is stored, like customer key, a key to another table (contact details), customer since date, etc. I also found numeric values in this table like "amount of purchases last 12 Month" or "Total shopping days" inside this table. That makes me wonder if it makes sense or not to store this measures inside the table, moreover, I'm building another table to store the customer data as a type II SCD and I´m not able to persuade the analyst to not include measures in this table.

What is your opinion about that?

Any comment would be appreciated.

Kind Regards,

Paul Hernández
Koen Verbeeck
Koen Verbeeck
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16516 Visits: 13210
I wouldn't store those in a dimension table. These are measures (albeit calculated), not attributes. These measures are facts that you should be able to calculate from the fact table (at the top of my head, the two examples you gave are very easy to calculate with TSQL).

Furthermore, these measures are very prone to change, so that would mean that you would have to update your customer dimension too often.



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at SQLKover.

MCSA SQL Server 2012 - MCSE Business Intelligence
Paul Hernández
Paul Hernández
SSC-Enthusiastic
SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)

Group: General Forum Members
Points: 173 Visits: 654
Thanks for your quick answer. That's exactly what I thought. I think aCRM guys are a little bit lazy and don't want to make joins. Anyway, there are a couple of values that we received from an external provider inside the Customer table that I cannot change. What I do is to create new tables and store aggregated measures in a new fact table and create also a new Customer table with the appropriate fields. Now I'll try the SCD Transfomation (SSIS 2008) that lets me treat some fields as type 1 and others as type 2.

Kind Regards,

Paul Hernández
prakashsa2709
prakashsa2709
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 106
Hi Paul,

I think that storing the value " amount of purchases last 12 Month" in the dimension table is valid.Let me explain one scenario where it would be usefull.Suppose If the user has to answer the business question the top ten customers in terms of purchases for the last twelve months then in such a scenario instead of calculating those figures from the fact it would be easier to query if they are stored in the dimension table.Hope it gives a valid reason for having it in the dim table
Koen Verbeeck
Koen Verbeeck
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16516 Visits: 13210
prakashsa2709 (11/1/2012)
Hi Paul,

I think that storing the value " amount of purchases last 12 Month" in the dimension table is valid.Let me explain one scenario where it would be usefull.Suppose If the user has to answer the business question the top ten customers in terms of purchases for the last twelve months then in such a scenario instead of calculating those figures from the fact it would be easier to query if they are stored in the dimension table.Hope it gives a valid reason for having it in the dim table


So you would recalculate your entire customer dimension each month?
What if you want history on that? Duplcate your entire customer dimension each month?



How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at SQLKover.

MCSA SQL Server 2012 - MCSE Business Intelligence
RonKyle
RonKyle
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1290 Visits: 3343
I think that storing the value " amount of purchases last 12 Month" in the dimension table is valid.


I agree. If the information is there, it must be valuable to your business users. You should make that information available in the dimension.



MMartin1
MMartin1
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1122 Visits: 2015
One reason I think this is not a good practice is that the cardinality can be quite high. This can be valid to do if business regards this as important. A better solution is to build categories into the dimension, So those customers that purchased between 0 and n are type 1, etc...etc...
As long as you dont forsee these categories changing. You can even base an attribute on if a customer is one of your top ten purchasers. I dont see an issue with reprocessing the dimension often as needed.

----------------------------------------------------
How to post forum questions to get the best help
PMwar
PMwar
SSC Journeyman
SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)SSC Journeyman (87 reputation)

Group: General Forum Members
Points: 87 Visits: 228
Given the use case ("amount of purchases last 12 Month"), I'd consider unlikely a user query like "amount of purchases last 12 Month" = 37, so the suggestion of categories seems adequate. But something like "amount of purchases last 12 Month" < 6 might be useful, and categories might mess this up :-D
But it's always the matter of understanding the need for this information and how it'll be used.

PMWar
MMartin1
MMartin1
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1122 Visits: 2015
"But something like "amount of purchases last 12 Month" < 6 might be useful, and categories might mess this up "

A good point but it still all fits. If the amount of people that bought 3,4,5 items is of reporting importance, then call just these categories cat3, cat4, cat5, etc.. As the number of purchases increase you can increase the span of each category in a mathematical fashion.

----------------------------------------------------
How to post forum questions to get the best help
Evil Kraig F
Evil Kraig F
SSCertifiable
SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)

Group: General Forum Members
Points: 5713 Visits: 7660
Paul,

In a case like this I would look towards chaining fact tables. I don't know the proper term, I'm not a warehouse expert, I just build 'em.

What it would look like is something like this:

(Existing Fact Tables) -> CustomerData with only attributes (Dimension) -> FactTable storing the calculated measures for date of measure taken.

You'd have to be careful about including only the most recent fact for each customer when treating it like a continuation of the dimension, but it will both allow you to monitor changes to the measures being delivered as well as separate out the concern of modifying attributes on a dimension when indeed your measures are mobile.

From there, you can have a discussion about 'better ways to achieve the same result' with your developers.


- Craig Farrell

Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

For better assistance in answering your questions | Forum Netiquette
For index/tuning help, follow these directions. |Tally Tables

Twitter: @AnyWayDBA
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search