Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to model a fact table
    primarykey
    data
    text
    <p>I'm about to create a data warehouse with facts and dimensions in a star-schema.</p> <p>The business questions I want to answer are typically these:</p> <ul> <li>How much money did we sell for in Q1?</li> <li>How much money did we sell for in Q1 to females?</li> <li>How much money did we sell for in Q1 to females between age 30-35?</li> <li>How much money did we sell for in Q1 to females between age 30-35 living in new york?</li> <li><p>How much money did we sell for in Q1 to females between age 30-35 living in new york?</p></li> <li><p>How much money did we sell for in category clothes last year?</p></li> <li>How much money did we sell for of the product blue jeans last year?</li> <li>How much money did we sell for of the product blue jeans to males between 40-42 living in Australia last year?</li> </ul> <p>I am thinking of a date dimension with the granularity of an hour (specifying year, month, day, hour, quarter, name of day, name of month etc.) I am also thinking of a product dimension and a user dimension.</p> <p>I wonder if these questions could be answered using a single fact table or if its proper to create multiple fact tables? I am thinking of a table such as:</p> <p><strong>FactSales</strong></p> <p>DimDate - fk to a table containting information about the date (such as quarter, day of week, year, month, day)</p> <p>DimProduct - fk to a table containing information about the product such as (product name)</p> <p>DimUser - fk to a table containing information about the user such as (age, gender)</p> <p>TotalSales - a SUM of all sales for those particular date,product and user.</p> <p>Also, if I would like to measure booth the total sales (money) and the total number of sales? Would it be proper to create a new fact table with the same dimensions but using TotalNumberOfSales as the fact instead?</p> <p>Thankful for all input I can get about this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload