Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Excel Data Model: Step-by-Step Example Guide

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

An Excel Data Model is a built-in feature that lets you combine multiple tables into a relational model, so you can analyze data from several sources without flattening it into one sheet. To create a working example, you import or link tables, add them to the Data Model when prompted, create relationships between them, and then build a PivotTable or Power Pivot report that pulls fields from multiple tables. This guide walks through a simple sales example using Excel for Microsoft 365 on Windows; the steps are similar on Mac and in Excel 2021/2019, though menu labels can differ slightly by version, device or region.

What You'll Need

  • Excel 2016 or later (Microsoft 365 recommended) with Power Pivot enabled. Power Pivot is built in but may need enabling via File > Options > Add-ins > COM Add-ins > Go > check Microsoft Power Pivot for Excel.
  • Two or more related tables. For this example: a Sales table with columns Date, ProductID, CustomerID, Units, and UnitPrice; and a Products table with ProductID, ProductName, and Category. Optionally a Customers table with CustomerID and CustomerName.
  • Data formatted as an Excel Table (select your range and press Ctrl+T) or loaded from Power Query. Each table needs a unique key column (e.g., ProductID) with no blanks or duplicates.

Step-by-Step

  1. Prepare your source tables. On separate worksheets, format each range as an Excel Table (Ctrl+T) and give each a meaningful name on the Table Design tab (e.g., tblSales, tblProducts). Ensure the key columns (ProductID, CustomerID) contain unique values in the lookup tables and no blanks in the fact table.
  2. Add tables to the Data Model. Click any cell in the Sales table, then go to Insert > PivotTable. In the Create PivotTable dialog, choose “Add this data to the Data Model” and click OK. Repeat for the Products table: select it, Insert > PivotTable, and again tick “Add this data to the Data Model.” You can also add tables via Data > Manage Data Model, but the PivotTable route is the simplest for a first model.
  3. Open Power Pivot to manage relationships. Go to the Power Pivot tab on the ribbon and click Manage. The Power Pivot window opens showing your tables in the Data View. If you don’t see the Power Pivot tab, enable the add-in as described in What You’ll Need.
  4. Create relationships. In the Power Pivot window, go to Design > Manage Relationships > Create. In the Create Relationship dialog, set Table to tblSales and Column to ProductID; set Related Table to tblProducts and Related Column to ProductID. Click Create. If you have a Customers table, repeat with CustomerID. Excel may auto-detect relationships when you add tables, but always verify them here.
  5. Check the model diagram. Still in Power Pivot, click Diagram View. You should see lines connecting the key columns. A correct model has a one-to-many relationship from the lookup table (Products) to the fact table (Sales). If a line is missing or points the wrong way, edit or delete the relationship and recreate it.
  6. Build a PivotTable from the model. Close the Power Pivot window. Go to Insert > PivotTable, choose “Use an Existing Worksheet” or New Worksheet, and ensure “Add this data to the Data Model” is ticked. In the PivotTable Fields pane, you’ll see all tables in the model. Expand tblSales and drag Units to Values; expand tblProducts and drag Category to Rows. The PivotTable now sums units by category across both tables.
  7. Add a measure for calculated results. In the PivotTable Fields pane, right-click tblSales and choose Add Measure. Name it Total Revenue, enter the formula =SUMX(tblSales, tblSales[Units] * tblSales[UnitPrice]), and click OK. Drag the new measure into Values. Measures are stored in the model and update with the data.
  8. Refresh and test. If you change data in the source tables, go to Data > Refresh All (or right-click the PivotTable and choose Refresh). Verify totals against a manual sum to confirm the relationships are working.

Common Mistakes

  • Duplicate or blank keys. Relationships fail if the lookup table’s key column has duplicates or blanks. Clean the data before adding it to the model.
  • Wrong direction. The “one” side must be the lookup table (Products) and the “many” side the fact table (Sales). Reversing them produces incorrect totals or errors.
  • Forgetting to tick “Add this data to the Data Model.” If you create a PivotTable without this option, the table won’t appear in the model and you can’t relate it.
  • Using VLOOKUP instead of relationships. The model is designed to avoid flattening; adding calculated columns with lookups defeats the purpose and bloats the file.
  • Not refreshing after source changes. PivotTables and measures don’t update automatically unless the source is an external connection with refresh settings.

Tips

  • Use Power Query (Data > Get & Transform Data) to import and clean tables before loading them to the model; this makes refreshes repeatable.
  • Name tables and columns clearly; spaces are allowed but brackets in formulas become cumbersome.
  • Keep the model lean: only add columns you need for analysis. You can hide unused columns in Power Pivot’s Data View.
  • Use Diagram View to spot missing relationships quickly; a well-formed model looks like a star with the fact table in the center.
  • Document your measures in a separate sheet so others understand the logic.

Troubleshooting

  • “We couldn’t create a relationship” error. Check for blanks, duplicates, or mismatched data types (text vs. number) in the key columns. Ensure both columns contain the same type of values.
  • PivotTable shows blanks or wrong totals. Verify the relationship direction and that the correct key columns are linked. Also confirm the fact table has matching key values.
  • Power Pivot tab missing. Enable the COM add-in: File > Options > Add-ins > Manage COM Add-ins > Go > check Microsoft Power Pivot for Excel > OK. Restart Excel if needed.
  • Refresh fails. If the source is an external database, check credentials and connectivity. For Excel tables, ensure the workbook is saved and the tables still exist.
  • File size grows unexpectedly. The model stores a copy of the data. Remove unnecessary columns or use Power Query to filter rows before loading.

Frequently Asked Questions

Do I need Power Pivot to use the Data Model?

No. You can add tables to the Data Model directly from Insert > PivotTable and create relationships via the PivotTable Fields pane (right-click a table and choose Add Relationship). Power Pivot gives you more control and measures.

Can I use the Data Model on Excel for Mac?

Yes, Excel for Mac supports the Data Model and Power Pivot, but the ribbon layout and some dialog labels differ. Look for the Data Model options under the Data tab or PivotTable Fields.

What’s the difference between a relationship and a VLOOKUP?

A relationship links tables logically without duplicating data; VLOOKUP physically pulls values into a column. Relationships are more efficient and update automatically with the model.

Can I add more tables later?

Yes. Add the table to the model (Insert > PivotTable > Add to Data Model) and create the relationship in Power Pivot or via the PivotTable Fields pane.

Why does my PivotTable show all categories even when there are no sales?

That’s normal: the lookup table lists all categories. To hide empty ones, filter the PivotTable or use a measure that returns blank for no sales.

Is the Data Model available in Excel 2010?

Excel 2010 has a limited version via the Power Pivot add-in, but it’s not built-in. For full functionality, use Excel 2016 or later.