Excel Data Model and Relationships
Connect sales, customers, products, employees and calendar tables into one reliable analytical model—without repeating master information inside every transaction row.
After This Chapter, You Will Be Able To
Design, connect, validate and use a professional Excel Data Model for multi-table analysis.
Classify Tables
Identify fact, dimension, lookup, bridge and calendar tables according to their business role.
Validate Keys
Check primary and foreign keys for uniqueness, completeness, compatibility and matching coverage.
Create Relationships
Build correct one-to-many relationships and avoid ambiguous or many-to-many structures.
Report Across Tables
Create multi-table PivotTables that combine descriptive fields with transaction measures.
Move Beyond One Large Flat Worksheet
A Data Model stores several related tables inside one workbook and allows Excel to analyze them together without repeating every master-data field in the transaction table.
1 What Is the Excel Data Model?
The Excel Data Model is an internal relational structure that can contain multiple tables, relationships and analytical calculations. It becomes especially useful when one flat worksheet would be too wide, repetitive, difficult to maintain or unable to represent the real business structure clearly.
Why a Model Is Better Than Repeating Everything
| Flat-File Habit | Data-Model Approach | Business Benefit |
|---|---|---|
| Customer name and city repeated on every invoice line | Customer details stored once in a Customer table | Less duplication and easier correction |
| Product category typed repeatedly | Product details linked through Product ID | Consistent classification |
| Monthly worksheets joined manually | Transactions loaded into one fact table | Scalable reporting |
| Complex lookup formulas across many columns | Relationships connect tables logically | Cleaner reporting structure |
Practical Experiment 1: Split a Flat Sales File
Take a sales sheet containing Invoice, Date, Customer, City, Product, Category, Quantity and Amount.
Mark fields repeated for the same customer and product.
Create Sales, Customers and Products tables with suitable key columns.
Explain how one correction in a master table replaces hundreds of repeated corrections.
2 Fact Tables and Dimension Tables
A strong model begins by assigning a clear role to every table. The most common structure uses one central fact table connected to several dimension tables.
- InvoiceLineIDPK
- DateKeyFK
- CustomerIDFK
- ProductIDFK
- QuantityMeasure
- NetAmountMeasure
Fact tables record business events. Their rows are normally numerous and contain measurable values plus foreign keys.
- CustomerIDPK
- CustomerNameAttribute
- CityAttribute
- SegmentAttribute
- ProductIDPK
- ProductNameAttribute
- CategoryAttribute
Fact Table
- Stores transactions, events or periodic snapshots.
- Contains measures such as quantity, sales, cost and hours.
- Usually has many rows.
- Contains foreign keys to dimensions.
Dimension Table
- Stores descriptive business information.
- Contains one unique row per customer, product, employee or date.
- Provides fields used for grouping and filtering.
- Should have a unique primary key.
Practical Experiment 2: Classify Business Tables
Review tables named Sales, Customers, Products, Employees, Calendar and SalesTargets.
Mark each table as fact, dimension or supporting table.
Write the grain: what one row represents in every table.
Identify fields that are stored in the wrong table.
Connect Tables Through Reliable Business Keys
A relationship works only when the connecting columns represent the same business entity and the lookup side contains one unique value for every key.
3 Primary Keys, Foreign Keys and Data Types
A primary key uniquely identifies each row in a dimension table. A foreign key appears in the fact table and points to the related dimension record.
Primary Key
One unique, nonblank value per dimension row—for example, CustomerID in DimCustomer.
Foreign Key
A repeating value in the fact table—for example, CustomerID in FactSales.
Compatibility
Both columns should use compatible data types and the same coding logic.
Key Validation Checklist
Practical Experiment 3: Audit Relationship Keys
Use CustomerID in a customer master and sales table.
Check duplicate CustomerIDs in the master table.
Identify sales CustomerIDs missing from the master.
Confirm both columns are stored consistently as text or number.
4 Cardinality and One-to-Many Relationships
Cardinality describes how many rows on one side can relate to rows on the other side. Most professional Excel models should be designed around one-to-many relationships.
One product connects to many transaction rows. This is the standard model relationship.
Each key appears once in both tables. Consider whether the tables should be combined.
Keys repeat on both sides. Redesign using a bridge or distinct lookup table.
A foreign key has no valid dimension record, producing blank or unknown reporting groups.
Why Duplicate Keys Cause Trouble
If ProductID appears twice in the Product table, Excel cannot safely treat that table as the unique lookup side. Duplicate keys may prevent relationship creation or produce uncertain business interpretation.
Practical Experiment 4: Repair a Many-to-Many Problem
Use a Sales table and a ProductCategory table where Category appears several times in both tables.
Explain why Category is not unique on either side.
Build a distinct Category table with one row per CategoryID.
Connect both business tables through the new distinct lookup.
5 Create and Manage Relationships in Excel
Tables can be added to the Data Model while importing through Power Query, while creating a PivotTable, or through Power Pivot. Relationships can then be created in Diagram View or through Excel’s relationship-management commands.
Prepare Tables
Use clean headers, keys and data types.
Add to Model
Load each required table to the Data Model.
Create Links
Connect foreign keys to unique dimension keys.
Test Report
Use fields from several tables in one PivotTable.
Relationship Management Practices
- Use business-friendly table and field names.
- Create relationships at the correct grain.
- Avoid connecting dimensions directly to dimensions unless the business design genuinely requires it.
- Document every relationship: from table, from column, to table, to column and expected cardinality.
- When multiple date columns exist, choose the main active date relationship for reporting; other date roles may require advanced DAX treatment later.
Practical Experiment 5: Create a Three-Table Model
Load Sales, Customers and Products to the Data Model.
Connect Sales[CustomerID] to Customers[CustomerID].
Connect Sales[ProductID] to Products[ProductID].
Create a PivotTable showing Sales Amount by Customer City and Product Category.
Build a Clear Star Schema
A star schema places the transaction fact table at the centre and connects it directly to descriptive dimensions. It is easier to understand, filter and maintain than a chain of unclear relationships.
6 Star Schema, Grain and Table Design
Define the Grain Before Creating Relationships
The grain states what one fact-table row represents. For example: “one row per invoice line,” “one row per employee per day,” or “one row per product per warehouse per month.” Mixing several grains in one fact table creates confusing totals and duplicated values.
| Table | Recommended Grain | Typical Key | Typical Measures / Attributes |
|---|---|---|---|
| FactSales | One invoice line | InvoiceLineID | Quantity, Gross Sales, Discount, Net Sales |
| DimCustomer | One customer | CustomerID | Name, City, Segment |
| DimProduct | One product | ProductID | Name, Category, Brand |
| DimDate | One calendar date | DateKey | Month, Quarter, Year, Financial Period |
Practical Experiment 6: Draw a Star Schema
Plan a retail model using Sales, Customers, Products, Stores and Calendar.
Place the transaction table in the middle and write its grain.
Place one unique dimension table for every reporting subject.
Write each primary key, foreign key and relationship direction.
7 Date Tables, Bridge Tables and Special Structures
A dedicated Date table gives consistent month, quarter, year, weekday and financial-period analysis. Bridge tables help resolve business structures where a simple one-to-many relationship is not available.
Date Dimension
Contains one row per date and supports consistent calendar and financial reporting across facts.
Bridge Table
Contains distinct connecting combinations, such as Employee–Project or Product–Tag membership.
Role-Playing Dates
Order Date, Ship Date and Payment Date may all connect to one Date dimension, but advanced measures determine which date role is used.
When a Bridge Table Is Needed
Suppose one employee can work on several projects and one project can contain several employees. Connecting Employees directly to Projects creates many-to-many behaviour. An EmployeeProject bridge with one row per valid assignment creates two controlled one-to-many relationships.
Practical Experiment 7: Build a Calendar and Bridge Design
Create a Date table for one year and an EmployeeProject assignment table.
Add Date, Month, Month Number, Quarter, Year and financial-period fields.
Create unique EmployeeID–ProjectID assignment rows.
Describe how both structures improve filtering and reporting accuracy.
Prove That the Model Produces Correct Results
A relationship diagram may look correct and still produce inaccurate totals. Professional users test keys, row counts, totals, blanks and filter behaviour.
8 Relationship Testing and Reconciliation
Professional Model Audit Sequence
- Confirm every table’s grain and expected row count.
- Test dimension keys for uniqueness and blanks.
- Test fact foreign keys for unmatched values.
- Reconcile basic measures before adding complex calculations.
- Filter by one dimension at a time and observe results.
- Check blank members and unexpected categories.
- Refresh with new records and repeat critical controls.
Practical Experiment 8: Perform a Complete Model Audit
Use the Sales–Customer–Product–Date model created earlier.
Compare fact-table row count and total sales with the source.
Test city, category and month filters independently.
Document every blank or unmatched model member and propose correction.
Select the Right Data-Model Design
Choose a business structure and receive a recommended table and relationship approach.
Build a Retail Sales Data Model
Create a complete multi-table analytical model that can answer management questions without lookup-heavy flat sheets.
Project Brief
A retail business has separate files for Sales, Customers, Products, Stores and Calendar. Management wants one PivotTable that can analyze net sales by city, product category, store type, salesperson and month.
Clean headers, assign data types, remove duplicate dimension keys and document grain.
Load only required analytical tables and keep unnecessary staging outputs connection-only.
Connect customer, product, store and date dimensions to the Sales fact table.
Create a multi-table PivotTable with filters and percentage-of-total analysis.
Reconcile row count, total sales, blank members and period totals.
Provide a schema diagram, key dictionary, relationship register and refresh checklist.
Required Outputs
- FactSales table with one row per invoice line.
- DimCustomer, DimProduct, DimStore and DimDate tables.
- Relationship diagram showing all one-to-many links.
- PivotTable: Net Sales by Month and Product Category, filterable by City and Store Type.
- Exception list for unmatched CustomerID, ProductID, StoreID or DateKey.
- One-page model quality and reconciliation report.
Complete These Data-Model Tasks
Save screenshots, relationship notes and validation results as part of your learning portfolio.
Design Tasks
- Write the grain of five sample business tables.
- Classify each table as fact, dimension or bridge.
- Identify primary and foreign keys.
- Draw a star schema for a service business.
- Create a Date table field list.
Validation Tasks
- Find duplicate keys on the lookup side.
- Find unmatched foreign keys in the fact table.
- Compare Data Model sales with source sales.
- Test filters from three dimensions.
- Document one refresh and reconciliation cycle.
Mistakes Data-Model Builders Should Avoid
A model is valuable only when relationships reflect the real business and produce trustworthy results.
Risky Habits
- Using names instead of stable IDs as relationship keys.
- Allowing duplicate values on the lookup side.
- Connecting tables with different data types.
- Mixing invoice-level and invoice-line-level records in one fact table.
- Creating many-to-many links without a clear bridge design.
- Using dimensions to store transaction measures.
- Ignoring blank members in PivotTables.
- Trusting the diagram without reconciling totals.
Professional Practices
- Use stable primary and foreign keys.
- Document one row’s meaning for every table.
- Build one-to-many relationships wherever possible.
- Use a star schema with clear fact and dimension roles.
- Create bridge tables only for valid business memberships.
- Use a dedicated Date dimension for time analysis.
- Investigate unmatched keys and blank groups.
- Reconcile counts and totals after every structural change.
Test Your Data Model Knowledge
Select the best answer for each question and review the explanation after submission.
1. What is the main purpose of the Excel Data Model?
2. Which table normally stores transaction measures such as quantity and net sales?
3. What should be true about a primary key in a dimension table?
4. In a standard one-to-many relationship, where should duplicate keys normally appear?
5. What does the grain of a table describe?
6. Which model structure places one fact table at the centre with dimensions around it?
7. What is a common solution when keys repeat on both sides of a business relationship?
8. Why is a dedicated Date table valuable?
9. What may cause a blank customer group in a multi-table PivotTable?
10. Which test confirms that model calculations preserve the source business value?
11. Which fields are normally used for grouping and filtering reports?
12. Which practice best supports a reliable Data Model refresh?
Remember These Data Model Principles
Review these concepts before learning Power Pivot and DAX measures.
Define the Grain
State exactly what one row represents before building relationships or calculations.
Separate Facts and Dimensions
Keep measurable events in facts and descriptive attributes in dimensions.
Use Stable Keys
Connect unique primary keys to compatible foreign keys.
Prefer One-to-Many
Use bridge or distinct lookup tables to resolve valid many-to-many structures.
Build a Star Schema
Connect dimensions directly to the central fact table for clear reporting.
Reconcile the Model
Test totals, blanks, row counts, filter behaviour and refresh results.