Im learning dimensional modeling and Im trying to create a model. I was thinking about a social media platform which rates hotels. The platform has following data:
- hotel information: name and address
- a user can rate hotels (1-5 points)
- a user can write comments
- platform stores the date of the comments
- hotel can answer via comment and it stores the date of it
- the platform stores the total number of each rating level (i.e.: all rates with 1 point, all rates with 2 point etc.)
- platform stores information of the user: sex, name, total number of votes he/she made and address
First, I tried to define which information belongs to a dimension or fact table
(here I also checked which one is additive/semi additive/non-additive)
I realized my example is kind of difficult, because it’s hard to decide if it belongs to a fact table or dimension.
I would like to hear some advice. Would someone agree with my model?
This is how I would model it:
- Hotel information -> hotel dimension
- User rating -> additive fact – because I can aggregate them with all dimensions
- User comment -> semi additive? – because I can aggregate them with the date dimension (I don’t know if my argument is correct, but I know I would have new comments every day, which is for me a reason to store it in a fact table
- Answer as comment -> same handling like with the user comments
- Date of comment-> dimension
- Total Number of all votes (1/2/3/4/5) -> semi-additive facts – makes no sense to aggregate them, since its already total but I would get the average
- User information sex and name, address -> user-dimension
- User Information: total number of votes -> could be dimension or fact. It depends how often it changes. If it changes often, I store it in a fact. If its not that often, then dimension
I still have question, hope someone can help me:
My Question: should I create two date dimensions, or can I store both information in one date dimension?
2nd Question: each user and hotel just have one address. Are there arguments, to separate the address dimension in a own hierarchy? Can I create a 1:1 relationship to a user dimension and address dimension?