Fact table vs dimension table: A fact table stores measurable, quantitative data about a business event, such as revenue, units sold, or clicks. A dimension table stores descriptive context about that event, such as customer name, product category, or store location. Together, they form the star schema at the core of every data warehouse and BI report.
A fact table records business events in numbers. A dimension table stores descriptive context about those events, like who made the purchase, where it happened, or what product was involved. Together, they form the backbone of a data warehouse and every BI report you have ever seen in tools like Power BI or Tableau.
Key Takeaways
- Fact tables hold numbers (revenue, quantity, clicks). Dimension tables hold labels (product name, city, customer name).
- A fact table’s rows represent individual events. Each row in a dimension table describes a single entity.
- The two table types connect through foreign keys inside the fact table pointing to primary keys in each dimension table.
- The grain of a fact table defines exactly what one row represents, and getting this wrong is the most common modelling mistake.
- Slowly changing dimensions (SCDs) handle how dimension data changes over time, something every data engineer deals with in production.
Facts and Dimensions in Simple Terms
Think about an order placed on Flipkart. The fact is the transaction itself: Rs 2,499 spent, 2 units purchased, on 14 October 2025. The dimensions are everything that gives that fact meaning: which customer bought it, which product they chose, which city they are in, and which date it happened on.
When you separate these two types of data into their own tables and connect them with keys, you get a star schema. The fact table sits at the centre. Dimension tables fan out around it like points on a star. This design is what makes large-scale analytical queries fast, and it is the standard pattern used in data warehouses built on platforms like Amazon Redshift, Google BigQuery, and Microsoft Azure Synapse.
The WEF Future of Jobs Report 2025 lists data analysts and scientists among the top five fastest-growing roles globally, with data engineering skills explicitly called out as critical for AI-driven teams. If you are exploring how to become a data engineer, understanding the fact table vs dimension table structure is one of the first things you will need to master.
Fact Table vs Dimension Table: What Each One Does
A fact table records business events in numbers. Every row is one occurrence of that event, and the table’s columns are either measures (the numeric values you aggregate) or foreign keys (the IDs that link to dimension tables). There is almost nothing else in there.
What Goes Inside a Fact Table
Take a retail sales fact table. A single row might look like this:
| sale_id | date_key | product_key | customer_key | store_key | quantity_sold | sale_amount_inr | discount_amount_inr |
|---|---|---|---|---|---|---|---|
| 10041 | 20251014 | P2201 | C8834 | S05 | 2 | 2499.00 | 200.00 |
| 10042 | 20251014 | P1190 | C0021 | S12 | 1 | 899.00 | 0.00 |
The keys (date_key, product_key, customer_key, store_key) contain no descriptive information on their own. They are just reference IDs. The actual measures, quantity_sold, sale_amount_inr and discount_amount_inr, are what analysts sum, average, and compare.
The Grain of a Fact Table
The grain is a precise statement of what one row represents. In the example above, the grain is “one line item sold in one transaction at one store on one date.” Defining this upfront stops your team from accidentally mixing different levels of detail in the same table, which creates aggregation errors that are genuinely painful to debug.
On the job, you will often hear a senior engineer ask “what’s the grain?” before reviewing any new fact table. It is not a trick question. It is the most important design decision you will make for that table.
Types of Fact Tables
- Transaction fact tables: one row per event (most common; the sales example above).
- Snapshot fact tables: one row per entity per time period, like monthly account balances.
- Accumulating snapshot tables: track a process through multiple stages, like an order moving from placed to shipped to delivered.
Dimension Tables Explained
A dimension table is wide and descriptive. It answers the “who, what, where, and when” questions about the events in your fact table. Rows are few compared to a fact table, but columns can be many. A product dimension might have 30 or more attributes: product name, category, subcategory, brand, colour, weight, supplier, and so on.
A Real Dimension Table Example
| customer_key | customer_id | full_name | city | state | tier | registration_date |
|---|---|---|---|---|---|---|
| C8834 | USR-99201 | Priya Sharma | Bengaluru | Karnataka | Gold | 2022-03-15 |
| C0021 | USR-10045 | Arjun Mehta | Pune | Maharashtra | Silver | 2023-07-01 |
None of those columns are numbers you would sum. They are all labels, categories, and descriptors. When a Power BI report filters “sales by state,” it is joining the fact table to this customer dimension on customer_key and grouping by the state column.
Slowly Changing Dimensions
Slowly changing dimensions (SCDs) describe how you handle changes to dimension data over time. If Priya Sharma moves from Bengaluru to Hyderabad, what do you do with her customer record? You have three standard options:
- SCD Type 1: Overwrite the old value. Simple, but you lose history. Good for correcting data entry errors.
- SCD Type 2: Add a new row with the updated value and mark the old row as expired. You keep full history. This is the most common production choice.
- SCD Type 3: Add a new column (e.g., previous_city). You track only one version of history, which is limited but sometimes sufficient.
Most enterprise warehouses use SCD Type 2 because analysts need to know what a customer’s city was at the time of purchase, not just what it is today. Getting this wrong means your historical reports silently show incorrect data, and that is a problem that often only surfaces months later.
Can a Table Be Both a Fact and a Dimension?
Yes. A degenerate dimension is a dimension attribute, like an order number, that lives inside the fact table because it has no other attributes to justify its own table. The order_number column is descriptive, but it lives in the fact table because there is nothing else to put in a separate dimension.
There is also the concept of a role-playing dimension, where one date dimension table is referenced multiple times in the same fact table under different aliases (order_date, ship_date, delivery_date). It is one physical table playing multiple roles.
This kind of nuanced modelling comes up constantly when working with large-scale systems. If you are curious about the infrastructure underneath, our guide on Hadoop and HDFS architecture explains how distributed storage handles the volumes these warehouses generate. And if you want the broader context, start with what is big data before going deeper into warehouse design.
Fact Table vs Dimension Table: Key Differences with Examples
Here is a direct side-by-side comparison of fact table vs dimension table using the retail sales scenario we have been building throughout this article.
| Attribute | Fact Table | Dimension Table |
|---|---|---|
| Purpose | Stores measurable events | Stores descriptive context |
| Column types | Measures + foreign keys | Attributes + primary key |
| Row count | Very high (millions to billions) | Lower (thousands to millions) |
| Data type | Numeric (INT, DECIMAL) | Text, dates, categories |
| Updates | Append-only (mostly) | Updated via SCD patterns |
| Example table | sales_fact | dim_customer, dim_product |
| Aggregation | SUM, AVG, COUNT on measures | GROUP BY on attributes |
According to NASSCOM’s India Tech Report 2024, India will need over 1.4 million data professionals by 2026, with data modelling and warehousing skills listed among the top three technical competencies employers are hiring for. Separately, IDC’s Worldwide Business Intelligence and Analytics Tools Forecast (2024) projects the global BI and analytics market will reach USD 33.7 billion by 2026, driven largely by organisations standardising on star schema data warehouse designs. If you are preparing for interviews, bookmark our list of data analyst interview questions because fact table vs dimension table questions appear regularly.
When you are building dashboards, this distinction matters directly. A common mistake is putting a text column like product_category inside the fact table instead of the dimension table. Queries still run, but they run slowly because you are scanning millions of rows to filter on a string instead of joining a small dimension. One e-commerce team in Hyderabad reduced their report load time from 45 seconds to under 3 seconds by moving misplaced attributes into a proper product dimension. That is the practical payoff of getting the fact table vs dimension table design right.
Indian enterprises across sectors, from retail giants like Reliance Retail to fintech platforms like Razorpay, rely on star schema designs where the fact table vs dimension table split is clearly enforced. Getting this right at the modelling stage saves weeks of rework when dashboards go live.
If you are deciding between BI tools to visualise this data, our comparison of Power BI vs Tableau breaks down which tool works better for different team sizes and budgets. Both connect natively to star schema models and use fact-dimension relationships to power their aggregations.
The difference between a data analyst vs data scientist also partly comes down to how deeply each role interacts with this layer. Analysts query the warehouse. Data scientists often need to understand the modelling decisions underneath to trust the numbers they are building models on.
Frequently Asked Questions
What is a fact table and dimension table?
A fact table stores quantitative, measurable data about business events, like sales amounts or units sold. A dimension table stores descriptive attributes that give context to those events, like customer names, product categories, or store locations. Together, they form a star schema used in data warehouses and BI reporting tools. Understanding the fact table vs dimension table split is foundational to data warehouse design.
What is the difference between facts and dimensions?
Facts are numeric measures you can aggregate: revenue, quantity, duration, clicks. Dimensions are descriptive attributes you use to filter or group those measures: city, product name, date, customer segment. The core rule is simple: if you would SUM or AVG it, it is a fact. If you would GROUP BY or filter on it, it is a dimension.
Can a table be both a fact and a dimension?
Yes, in specific cases. A degenerate dimension is a dimension attribute, like an order number, that lives inside the fact table because it has no other attributes to justify its own table. Role-playing dimensions let one physical dimension table serve multiple fact table relationships under different aliases, like a date dimension used for order date, ship date, and delivery date simultaneously.
What is the grain of a fact table?
The grain is a precise declaration of what one row in the fact table represents. For example, “one product sold in one transaction at one store on one day” is a grain statement. Defining the grain before building the table prevents you from mixing rows at different levels of detail, which causes silent aggregation errors that are hard to catch after the fact.
What are slowly changing dimensions?
Slowly changing dimensions (SCDs) are a set of patterns for handling changes to dimension data over time. Type 1 overwrites the old value (no history kept). Type 2 adds a new row with effective dates so you preserve full history, which is the most widely used approach in production warehouses. Type 3 adds a column to track only the most recent previous value.
What is the difference between a star schema and a snowflake schema?
In a star schema, each dimension table connects directly to the central fact table with no further normalisation. In a snowflake schema, dimension tables are normalised into sub-dimension tables, reducing redundancy but adding join complexity. Most BI tools and data warehouses prefer the star schema because it produces faster query performance and simpler SQL.
Your next step from here: You now know what separates a fact table from a dimension table, why grain matters, and how SCDs work in practice. Here is what to do this week:
- Sketch a star schema for a business you know, a college canteen, a small retailer, or a streaming service, and label every table as fact or dimension before writing a single line of SQL.
- Read through our guide on how to become a data engineer to see where data modelling fits in the full career path and which other skills sit alongside it.
- If you want to build industry-recognised credentials fast, explore the 3.0 University online certification courses in Cybersecurity, AI, Blockchain and Web3. Data modelling skills are increasingly valued in security analytics and SOC teams. The EC-Council Certified SOC Analyst course is a strong starting point if you want to combine data skills with a high-demand security career.
Last updated: April 2025. Reviewed by the 3University editorial team.