Tag: Star Schema

The Fundamentals of Star Schemas

Introduction

If there is one data modeling concept that every data analyst, data engineer, and Power BI developer should understand, it is the star schema.

Although modern analytics platforms provide powerful capabilities for importing, transforming, and analyzing data, the quality of your reports ultimately depends on the quality of your data model. A well-designed star schema makes reports easier to build, improves query performance, reduces complexity, and helps ensure accurate calculations.

Whether you’re creating a Power BI semantic model, designing a Microsoft Fabric Warehouse, building an Azure SQL data warehouse, or developing a traditional enterprise data warehouse, the star schema remains the industry standard for organizing analytical data.


What Is a Star Schema?

A star schema is a data modeling technique that organizes data into two primary types of tables:

  • Fact tables
  • Dimension tables

The fact table sits in the center of the model, while the dimension tables surround it, creating a shape that resembles a star.

             Product
                |
Customer --- Sales Fact --- Date
                |
            Salesperson
                |
             Geography

This simple design makes it easy for reporting tools to aggregate data while allowing users to filter information by various business attributes. Star Schema models are sometimes called Dimensional Models.


Fact Tables

A fact table stores measurable business events.

Each row typically represents a single business transaction or event.

Examples include:

  • Sales transactions
  • Orders
  • Shipments
  • Inventory movements
  • Website visits
  • Financial journal entries

Fact tables usually contain:

  • Numeric values (sales amount, quantity, cost)
  • Foreign keys pointing to dimensions
  • Sometimes transaction identifiers

Example:

DateKeyProductKeyCustomerKeyQuantitySalesAmount
202607011258453$149.97
202607014502101$89.99

Notice that the fact table stores very little descriptive information. Instead, it references other tables.


Dimension Tables

Dimension tables describe the facts.

Rather than storing numbers, they store descriptive attributes used for filtering, grouping, and reporting.

Examples include:

  • Customer
  • Product
  • Date
  • Employee
  • Store
  • Vendor
  • Geography

A Product dimension might contain:

ProductKeyProductNameCategoryBrandColor
125Wireless MouseAccessoriesContosoBlack

A Customer dimension may include:

  • Customer Name
  • City
  • State
  • Country
  • Customer Segment
  • Industry

These tables provide the business context needed to interpret the facts.


Why Is It Called a Star Schema?

When diagrammed visually, the fact table appears in the middle while dimension tables radiate outward.

           Product

Customer  Sales  Date

         Geography

        Salesperson

Unlike more complicated database designs, each dimension typically connects directly to the fact table.

This simplicity is one of the reasons star schemas are so effective.


Relationships

In a star schema:

  • One dimension row relates to many fact rows.
  • Fact tables contain foreign keys.
  • Dimension tables contain primary keys.

For example:

Product
---------
ProductKey (Primary Key)
|
|
Sales Fact
----------
ProductKey (Foreign Key)

This creates a one-to-many relationship, which is ideal for analytical workloads.


What Is Granularity?

Granularity refers to the level of detail stored in the fact table.

Examples:

Daily Sales: One row per day.

Transaction Sales: One row per individual purchase.

Order Line Sales: One row for every item sold on an order.

The more detailed the granularity, the more flexible the reporting becomes.

Choosing the correct grain is one of the most important design decisions in a star schema.


Common Dimension Tables

Nearly every warehouse includes some common dimensions.

Date Dimension

Perhaps the most important dimension.

Contains attributes like:

  • Date
  • Year
  • Quarter
  • Month
  • Month Name
  • Week
  • Fiscal Year
  • Holiday Indicator

Instead of calculating these repeatedly, reports simply reference the Date dimension.


Product Dimension

Contains:

  • Product Name
  • Category
  • Subcategory
  • Brand
  • Color
  • Size
  • SKU

Customer Dimension

Contains:

  • Customer Name
  • Region
  • Industry
  • Segment
  • Customer Type

Geography Dimension

Contains:

  • Country
  • State
  • Province
  • City
  • Postal Code
  • Sales Territory

Measures vs Attributes

Understanding the difference between measures (stored in Fact tables) and attributes (stored in Dimension tables) is essential.

Measures (Fact Table)

  • Sales Amount
  • Cost
  • Quantity
  • Profit
  • Hours Worked

Attributes (Dimension Tables)

  • Product Name
  • Customer Name
  • State
  • Department
  • Month
  • Category

A simple way to think about it:

Numbers that are aggregated belong in fact tables. Descriptive information belongs in dimension tables.


Benefits of Star Schemas

1. Better Performance

Reporting engines such as Power BI are optimized for star schemas.

Fewer joins result in:

  • Faster queries
  • Better compression
  • Reduced memory usage

2. Simpler Reports

Users can easily understand:

  • Sales by Month
  • Sales by Customer
  • Sales by Product
  • Sales by Region

Instead of navigating dozens of interconnected tables, report authors work with a clean, intuitive model.


3. Easier Maintenance

Changes to one dimension rarely affect other dimensions.

Adding a new Product Category only requires updating the Product dimension.

The fact table usually remains unchanged.


4. Improved Data Quality

Because descriptive information is stored once, duplication is minimized.

For example, “Florida” exists once in a Geography dimension instead of appearing in millions of sales rows.


5. Scalability

Star schemas scale exceptionally well.

Many enterprise warehouses contain:

  • Billions of fact rows
  • Millions of customers
  • Hundreds of thousands of products

The design continues to perform efficiently.


Star Schema vs Flat Tables

Some beginners attempt to place every column into one enormous table.

While this may seem easier initially, it creates several problems:

  • Duplicate data
  • Larger storage requirements
  • Slower refreshes
  • Poor compression
  • Difficult maintenance

A star schema separates repeated descriptive information from transactional data, making the model both smaller and faster.


Star Schema vs Snowflake Schema

A related design is the snowflake schema.

Instead of storing all descriptive information in a single dimension, dimensions are normalized into multiple tables.

Example:

Product
|
Category
|
Department

Advantages:

  • Less duplicated data
  • Smaller dimension tables

Disadvantages:

  • More joins
  • More complicated reports
  • Slower query performance
  • Harder for business users to understand

For Power BI and most analytics solutions, a star schema is generally preferred.


Best Practices

When designing a star schema:

  • Determine the grain of each fact table before loading data.
  • Use surrogate keys for dimension relationships when appropriate.
  • Keep dimensions descriptive and facts numeric.
  • Avoid storing repeated descriptive data in fact tables.
  • Use conformed dimensions (such as Date or Customer) across multiple fact tables.
  • Create one-to-many relationships from dimensions to facts.
  • Keep the model as simple as possible.
  • Hide technical key columns from report consumers.
  • Use meaningful table and column names.
  • Document the purpose of each fact and dimension.

Common Mistakes to Avoid

New developers often make these mistakes:

  • Building one giant table containing everything.
  • Creating many-to-many relationships unnecessarily.
  • Using bidirectional filtering without a clear need.
  • Mixing transaction-level and summary-level data in the same fact table.
  • Including calculated totals in fact tables instead of calculating them in reports.
  • Storing descriptive text in fact tables.
  • Ignoring the importance of a proper Date dimension.

Avoiding these pitfalls leads to cleaner, more maintainable models.


Star Schemas in Power BI

Power BI is designed to work exceptionally well with star schemas.

Benefits include:

  • Faster report performance
  • Better DAX calculation behavior
  • Simpler filter propagation
  • Easier report development
  • Improved semantic model organization

Microsoft recommends using star schemas whenever possible when designing Power BI semantic models.


Real-World Example

Imagine a retail company tracking sales.

Sales Fact

  • Sales Amount
  • Quantity
  • Discount
  • Cost

Connected to:

  • Date
  • Customer (contains Customer Segment)
  • Product
  • Store (contains Region)
  • Employee
  • Promotion

Business users can easily answer questions such as:

  • Which products sold the most this month?
  • Which region generated the highest profit?
  • What is the average order value by customer segment?
  • Which promotions increased sales?
  • How did sales compare year over year?

This flexibility is one of the major reasons star schemas have become the standard for business intelligence.


Frequently Asked Questions

Can a star schema have multiple fact tables?

Yes. Many enterprise data warehouses include multiple fact tables, such as Sales, Inventory, Budget, and Returns, all sharing common dimensions like Date, Product, and Customer.

Why shouldn’t descriptive columns be stored in fact tables?

Doing so increases duplication, wastes storage, and makes updates more difficult. Dimension tables provide a single source of truth for descriptive information.

Are star schemas only used in Power BI?

No. Star schemas are widely used in Microsoft Fabric, Azure Synapse Analytics, SQL Server, Oracle, Snowflake, Amazon Redshift, Google BigQuery, and many other analytics platforms.

Is a star schema required?

Not always, but it is considered the best practice for most analytical reporting and business intelligence solutions because it balances simplicity, performance, and scalability.


Conclusion

The star schema is one of the most important concepts in modern analytics and data warehousing. By separating measurable business events into fact tables and descriptive business information into dimension tables, it creates a model that is easy to understand, efficient to query, and scalable for organizations of any size.

Whether you’re building dashboards in Power BI, designing a Microsoft Fabric Warehouse, or developing an enterprise data warehouse, mastering star schema fundamentals will help you create faster reports, more reliable analytics, and data models that are easier to maintain over time. A solid star schema is not just a design choice—it is the foundation of effective business intelligence.

Thanks for reading!

Create Fact Tables and Dimension Tables (PL-300 Exam Prep)

This post is a part of the PL-300: Microsoft Power BI Data Analyst Exam Prep Hub; and this topic falls under these sections:
Prepare the data (25–30%)
--> Transform and load the data
--> Create Fact Tables and Dimension Tables


Note that there are 10 practice questions (with answers and explanations) for each section to help you solidify your knowledge of the material. Also, there are 2 practice tests with 60 questions each available on the hub below the exam topics section.

Creating fact tables and dimension tables is a foundational step in preparing data for analysis in Power BI. For the PL-300: Microsoft Power BI Data Analyst exam, this topic tests your understanding of data modeling principles, especially how to structure data into a star schema using Power Query before loading it into the data model.

Microsoft emphasizes not just what fact and dimension tables are, but how and when to create them during data preparation.


Why Fact and Dimension Tables Matter

Well-designed fact and dimension tables:

  • Improve model performance
  • Simplify DAX measures
  • Enable accurate relationships
  • Support consistent filtering and slicing
  • Reduce ambiguity and calculation errors

Exam insight: Many PL-300 questions test whether you recognize when raw data should be split into facts and dimensions instead of remaining as a single flat table.


What Is a Fact Table?

A fact table stores quantitative, measurable data that you want to analyze.

Common Characteristics

  • Contains numeric measures (Sales Amount, Quantity, Cost)
  • Includes foreign keys to dimension tables
  • Has many rows (high granularity)
  • Represents business events (sales, orders, transactions)

Examples

  • Sales transactions
  • Inventory movements
  • Website visits
  • Financial postings

What Is a Dimension Table?

A dimension table stores descriptive attributes used to filter, group, and label facts.

Common Characteristics

  • Contains textual or categorical data
  • Has unique values per key
  • Fewer rows than fact tables
  • Provides business context

Examples

  • Customer
  • Product
  • Date
  • Geography
  • Employee

Star Schema (Exam Favorite)

The recommended modeling approach in Power BI is the star schema:

  • One central fact table
  • Multiple surrounding dimension tables
  • One-to-many relationships from dimensions to facts
  • Single-direction filtering (typically)

Exam insight: If a question asks how to optimize performance or simplify DAX, the answer is often “create a star schema.”


Creating Fact and Dimension Tables in Power Query

Starting Point: Raw or Flat Data

Many data sources arrive as a single wide table containing both measures and descriptive columns.

Typical Transformation Approach

  1. Identify measures
    • Numeric columns that should remain in the fact table
  2. Identify dimensions
    • Descriptive attributes (Product Name, Category, Customer City)
  3. Create dimension tables
    • Reference the original query
    • Remove non-relevant columns
    • Remove duplicates
    • Rename columns clearly
    • Ensure a unique key
  4. Create the fact table
    • Keep foreign keys and measures
    • Remove descriptive text fields now handled by dimensions

Keys and Relationships

Dimension Keys

  • Primary key in the dimension table
  • Must be unique and non-null

Fact Table Keys

  • Foreign keys referencing dimension tables
  • May repeat many times

Exam insight: PL-300 questions often test your understanding of cardinality (one-to-many) and correct relationship direction.


Common Dimension Types

Date Dimension

  • Often created separately
  • Supports time intelligence
  • Includes Year, Quarter, Month, Day, etc.

Role-Playing Dimensions

  • Same dimension used multiple times (e.g., Order Date, Ship Date)
  • Requires separate relationships

Impact on the Data Model

Creating proper fact and dimension tables results in:

  • Cleaner Fields pane
  • Easier measure creation
  • Improved query performance
  • Predictable filter behavior

Poorly designed models (single flat tables or snowflake schemas) can lead to:

  • Complex DAX
  • Ambiguous relationships
  • Slower performance
  • Incorrect results

Common Mistakes (Often Tested)

❌ Leaving Data in a Single Flat Table

This often leads to duplicated descriptive data and poor performance.


❌ Creating Dimensions Without Removing Duplicates

Dimension tables must contain unique keys.


❌ Including Measures in Dimension Tables

Measures belong in fact tables, not dimensions.


❌ Using Bi-Directional Filtering Unnecessarily

Often used to compensate for poor model design.


Best Practices for PL-300 Candidates

  • Design with a star schema mindset
  • Keep fact tables narrow and tall
  • Keep dimension tables descriptive
  • Use Power Query to shape tables before loading
  • Rename tables and columns clearly
  • Know when not to split (very small or static datasets)

Know when not to over-model: If the dataset is extremely small or used for a simple report, splitting into facts and dimensions may not add value.


How This Appears on the PL-300 Exam

Expect scenario-based questions such as:

  • A dataset contains sales values and product details — how should it be structured?
  • Which table should store numeric measures?
  • Why should descriptive columns be moved to dimension tables?
  • What relationship should exist between fact and dimension tables?

These questions test modeling decisions, not just terminology.


Quick Comparison

Fact TableDimension Table
Stores measurementsStores descriptive attributes
Many rowsFewer rows
Contains foreign keysContains primary keys
Central tableSurrounding tables
Used for aggregationUsed for filtering

Final Exam Takeaways

  • Fact and dimension tables are essential for scalable Power BI models
  • Create them during data preparation, not after modeling
  • The PL-300 exam emphasizes model clarity, performance, and correctness
  • Star schema design is a recurring exam theme

Practice Questions

Go to the Practice Exam Questions for this topic.