Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 7

Dimensional Modeling Essentials: Facts, Dimensions, and Measures

This lesson is built with resources from youtube.com, kimballgroup.com and 1 more site.

Hello! Welcome to the first lesson of Module 2, "Advanced Data Modeling Techniques."

In the previous module, we explored the high-level blueprints of modern data platforms, such as the Lambda, Kappa, and Data Mesh architectures. Now, we will shift our focus from the macro view of system components to the micro view of how data is structured within those systems for analysis.

Today's lesson addresses the first learning outcome of this module: to describe the core concepts of dimensional modeling: facts, dimensions, and measures. As a software and enterprise architect, you're accustomed to designing systems that meet user needs. Dimensional modeling is a design paradigm specifically created to make data intuitive and performant for business users and analysts. Understanding these fundamentals is the first step toward designing effective data warehouses and analytical systems.

From Normalized to Dimensional: A New Perspective

In your experience with relational databases for software applications (often called Online Transaction Processing or OLTP systems), you've likely worked with highly normalized models, such as those in Third Normal Form (3NF). The primary goal of normalization is to eliminate data redundancy and ensure data integrity, which is perfect for systems that handle frequent writes and updates, like an e-commerce checkout process.

However, for analytics and reporting (Online Analytical Processing or OLAP), this highly normalized structure can be a disadvantage. Answering a simple business question like "What were the total sales for Brand X in the Northeast region last quarter?" might require joining a dozen different tables, making queries complex to write and slow to run.

Dimensional modeling, championed by Ralph Kimball, takes a different approach. Its primary goals are:

  1. Understandability: To present data in a way that is intuitive to business users.
  2. Performance: To deliver fast query results for analytical questions.

It achieves this by organizing data into a structure that mirrors how business people think: by measuring key performance indicators (the facts) across various business contexts (the dimensions).


The Star Schema: A Visual Introduction

The most common implementation of a dimensional model is the star schema, so named because its diagram resembles a star. Let's start with a quick video overview that introduces all the key players.

Master Dimensional Modeling Lesson 01 - Why Use a Dimensional Model?

The video "Master Dimensional Modeling Lesson 01" provides a concise, 2-minute tour of a simple star schema, defining the fact table, measures, and dimensions.

Please watch from 00:19 to 01:51. Focus on identifying the central table, the surrounding tables, and the terms used to describe them (fact, measure, dimension).

As the video explained, the star schema has two fundamental types of tables: a single, central fact table and several surrounding dimension tables.

Here is a classic diagram of a star schema. Keep this structure in mind as we explore each component in more detail.

Relational Dimensional Model (Star Schema Example)
This diagram shows a typical star schema. The central 'Sales Fact' table contains numeric measures and foreign keys that link to the surrounding 'Date', 'Product', 'Customer', and 'Store' dimension tables, which contain descriptive attributes.

Fact Tables and Measures: The "What"

The fact table is the heart of the star schema. It contains the quantitative measurements of a business process. Think of it as recording the events that happen.

  • A fact is a row in this table. It represents a specific measurement event (e.g., the sale of one product to one customer, a single website click, a daily inventory count).
  • Measures are the numeric columns in the fact table. They are the actual numbers that business users want to sum, average, count, and analyze (e.g., Sales Amount, Order Quantity, Unit Price).

A critical concept for fact tables is the grain. The grain defines exactly what a single fact row represents. Declaring the grain is the most important step in dimensional design. For example, the grain of a sales fact table could be:

  • "One row per individual sales transaction line item." (Fine-grained)
  • "One row per store per day." (Coarser-grained)

A finer grain provides more flexibility for analysis, as it's always possible to aggregate fine-grained data to a coarser level, but you can never go the other way.

To deepen your understanding of fact tables and the concept of grain, watch the following segment.

Data Modeling Tutorial: Star Schema (aka Kimball Approach)

The video "Data Modeling Tutorial: Star Schema" from Kahan Data Solutions offers a practical explanation of fact tables and the importance of choosing the right grain.

Watch from 01:17 to 03:51. Pay close attention to the definition of a fact table and the discussion around "declaring the grain" using the orders vs. transactions example.

Besides the measures, the only other things in a fact table are the foreign keys that connect to the dimension tables. This makes fact tables "narrow" (few columns) but "deep" (many, many rows).


Dimension Tables and Attributes: The "Who, What, Where, When"

A measure like "100,000" in sales is meaningless without context. Did that happen today? In which store? For which product?

Dimension tables provide this descriptive context.

  • A dimension is a table that contains the attributes related to a business entity (e.g., a Product dimension, a Customer dimension).
  • Attributes are the columns in a dimension table. They are the textual, descriptive labels we use for filtering, grouping, and labeling our reports (e.g., ProductName, Category, CustomerCity, Region).

Dimensions answer the "who, what, where, when, why, and how" associated with a fact event.

A key characteristic of dimension tables is that they are denormalized. Unlike in a 3NF model where you might have separate tables for ProductCategory and ProductBrand that link to Product, in a dimensional model, these attributes are all included directly in the Product dimension table. This creates "wide" tables with many columns. This redundancy is a deliberate trade-off to simplify and speed up queries by reducing the number of joins needed.

This next video clip explains this concept well.

Data Modeling Tutorial: Star Schema (aka Kimball Approach)

Let's return to the "Data Modeling Tutorial: Star Schema" video to see a practical explanation of dimension tables.

Watch from 06:43 to 08:41. Notice how dimension tables are described as providing context and are typically "wide and flat denormalized tables."

Test your understanding!

Imagine you are designing a data mart for an online learning platform like Coursera. The business wants to analyze student enrollment trends. For the business process of "a student enrolling in a course," identify one potential fact table, at least three measures, and at least three dimensions with some of their attributes.

Show answer
  • Fact Table: FactEnrollment
  • Grain: One row per student enrollment in a single course.
  • Measures:
    • EnrollmentCount (which would always be 1 at this grain, but is useful for counting)
    • CourseFeePaid
    • DiscountAmount
  • Dimensions:
    • DimStudent: with attributes like StudentName, Country, RegistrationDate.
    • DimCourse: with attributes like CourseTitle, Subject, InstructorName, Level (Beginner/Intermediate/Advanced).
    • DimDate: with attributes like FullDate, MonthName, Year, Quarter.

Conclusion

In this lesson, we introduced the fundamental building blocks of dimensional modeling. This approach is a cornerstone of data warehousing and business intelligence, designed to make data easy to query and understand.

Key Takeaways:

  • Dimensional Modeling: A design technique for analytical databases that prioritizes query performance and business user intuition over the data normalization found in transactional systems.
  • Fact Tables: Contain the numerical measurements (measures) of a business process. They are deep (many rows) and narrow (few columns). The grain defines the level of detail for each row.
  • Dimension Tables: Provide the descriptive context (attributes) for the facts, answering who, what, where, and when. They are typically wide (many columns) and denormalized to simplify queries.
  • Star Schema: The structure that connects a central fact table to its surrounding dimension tables via foreign keys.

In our next lesson, we will build directly on these concepts. You will learn how to apply this knowledge to design a star schema for a given business scenario, moving from theory to practical application.