In Power BI and other data modeling environments, Dimension Tables and Fact Tables are two core components of a star schema or snowflake schema that structure the data for reporting and analysis.
![start-schema-overview](https://colorstech.net/wp-content/uploads/2025/01/start-schema-overview.png)
1. Fact Table:
The Fact Table is the central table in a data model. It stores quantitative data (facts) that can be aggregated and analyzed. It typically contains numeric measures (such as sales, profit, quantity) and foreign keys that link to the dimension tables.
Example of a Fact Table:
Consider a sales database. A Sales Fact Table may look like this:
SalesID | ProductID | DateID | StoreID | QuantitySold | SalesAmount |
---|---|---|---|---|---|
1 | 101 | 202301 | 1 | 5 | 100 |
2 | 102 | 202301 | 2 | 3 | 60 |
3 | 103 | 202302 | 1 | 8 | 160 |
4 | 101 | 202302 | 3 | 2 | 40 |
Here:
SalesID
is a unique identifier for each sale transaction.ProductID
,DateID
, andStoreID
are foreign keys that link to dimension tables.QuantitySold
andSalesAmount
are facts (measures).
2. Dimension Table:
The Dimension Tables contain descriptive attributes or categorical information. These tables help provide context to the facts and are typically used to filter, group, or aggregate the data. They are linked to the fact table using foreign keys.
Example of Dimension Tables:
- Product Dimension Table:
ProductID | ProductName | Category |
---|---|---|
101 | Widget A | Electronics |
102 | Widget B | Apparel |
103 | Widget C | Furniture |
- Date Dimension Table:
DateID | Date | Month | Year |
---|---|---|---|
202301 | 2023-01-01 | Jan | 2023 |
202302 | 2023-02-01 | Feb | 2023 |
- Store Dimension Table:
StoreID | StoreName | Location |
---|---|---|
1 | Store One | New York |
2 | Store Two | Chicago |
3 | Store Three | Los Angeles |
Relationships between Tables:
In this example:
- The Sales Fact Table links to the Product Dimension Table using
ProductID
. - The Sales Fact Table links to the Date Dimension Table using
DateID
. - The Sales Fact Table links to the Store Dimension Table using
StoreID
.
This star schema enables users to analyze sales by product, date, and store. For example, you can quickly query the total sales for a specific product in a particular store, within a certain date range.
Summary:
- Fact Table: Stores quantitative data (facts) like sales, profit, etc.
- Dimension Table: Stores descriptive information (like product names, dates, store locations) to provide context for the facts.
In Power BI, these tables are typically connected using relationships that allow users to build visualizations, aggregations, and reports.