fx Thinking in Data

Fact table vs dimension table — the foundation of reporting

⏱ 10 min

What you'll learn

  • Two kinds of tables
  • Keys connect them
  • Why not one big sheet?

Concept

1. Two kinds of tables

Fact table — events that happened, with numbers. Many rows, grows every day.

OrderID OrderDate StoreID ProductID Qty UnitPrice
100001 01-04-2025 S01 P02 1 55000
100002 01-04-2025 S05 P12 4 450

Dimension tables — descriptions of the things in the facts. Few rows, change rarely.

ProductID Product Category UnitCost
P02 Laptop Electronics 48000
P12 Water Bottle Kitchen 220
StoreID StoreName City Region
S01 Karol Bagh Delhi North

2. Keys connect them

ProductID is unique in the Products table (a primary key) and repeats in the Sales table (a foreign key). One product → many sales: a one-to-many relationship.

3. Why not one big sheet?

If every sales row also stores Product name, Category, Store name, City and Region:

  • the file is many times bigger,
  • one category rename means changing thousands of rows (and missing some),
  • typos create fake categories ("Electronic" vs "Electronics").

Split tables: change a category once in Products, and every report updates.

4. Grain — what one fact row means

Always be able to finish the sentence: "One row in this table = one ___."

  • one invoice line (product per invoice) — common for retail,
  • one invoice (total only) — can't analyse by product,
  • one day per store — summary, can't see individual orders.

Mixing grains (some rows are invoices, some are daily totals) gives wrong totals. Choose the finest grain you need.

5. The star schema

              Products
                  │
   Calendar ── Sales (fact) ── Stores
                  │
               Targets*

Facts in the middle, dimensions around it — a star. Excel's Data Model (Module 4) and Power BI work best this way.

*Targets are another fact table at a different grain (region × month), joined through shared dimensions.

6. Don't forget the Calendar dimension

A Date table with one row per day and columns like Month, Quarter, Financial Year (Apr–Mar), Day name. It lets you report by FY and makes time intelligence (YTD, last year) work in Module 4.

7. Before the Data Model: XLOOKUP still works

Even without Power Pivot, keep dimensions as separate Tables and bring in what you need with XLOOKUP (Foundations Module 4) or a Power Query merge (Module 3).

Common mistakes

Duplicate keys in a dimension table (two rows for P02 → double counting). Keys with extra spaces ("S01 " ≠ "S01"). Mixing grains in one fact table.

Exercises

mediumTake one of your own sales sheets that repeats product names and categories on every row. Split it into a Sales fact table (IDs + numbers) and a Products dimension table (one row per product). Check the dimension has no duplicate IDs with =COUNTIF([ProductID],[@ProductID])>1.
Keep transaction IDs, Date, ProductID, Qty and Amount in the fact; put each ProductID and its descriptive attributes once in Products. COUNTIF on each dimension key must return 1. For the capstone: 50000 facts, 12 unique products, 8 unique stores; trimmed foreign keys have zero unmatched rows.

Quiz

Which table type has many rows and numbers?
Fact table
In a one-to-many relationship, where is the key unique?
In the dimension table
What does "grain" mean?
What one row of the fact table represents
Fact table vs dimension table — the foundation of reporting · Analysis & Visualization | ExcelWalaa