In Part 1, I walked through our planning process and how we used the SunBeam model to keep our modelling decisions centered around the business question.

In Part 2, I’ll walk through how Derek Lein and I took our conceptual model a step further by creating our Entity-Relationship Diagram (ERD).

Designing and Connecting

With our SunBeam model, we identified the tables and fields that are essential to our analysis. Now, we need to figure out how these tables relate to one another.

I like to think of an ERD as a more detailed and technical sketch of our data model. With it, we map out the relationships between our tables while taking two important concepts into consideration:

Cardinality – How many records in one table can relate to records in another? There are three main types of relationships:

  • One-to-One (1:1): One record in a table relates to only one record in another table.
  • One-to-Many (1:M): One record in a table can relate to multiple records in another table. For example, one product can appear in many sales transactions.
  • Many-to-Many (M:M): Multiple records in one table can relate to multiple records in another. For example, a promotion can apply to multiple products, and a product can be part of multiple promotions.

Understanding cardinality helps us avoid unintentionally duplicating records and inflating our numbers when joining tables.

Referential Integrity – Do the records that are supposed to relate to one another actually have a valid match? For example, does every Product ID in our Sales table exist in our Production Cost table? Checking this helps us identify missing or unmatched records that could affect the accuracy of our analysis.

Understanding both is important because we don't just want our tables to connect — we want them to connect in a way that keeps our data reliable and our analysis accurate.

Structuring Our Data Model

From our seven original tables, we narrowed down our data model to just four tables.

At the center of our ERD is our Stores dimension table, with Store ID as its primary key. Since our analysis revolves around store performance, it made sense to use this table as the common link between our three tables: consolidated transactions, fixed store costs, and employee salaries.

Each table has a many-to-one (*:1) relationship with our Stores table. Essentially, one store can have many sales transactions, fixed expenses, and employee salary records.

Another important consideration when designing our ERD was granularity. What does each row of data represent? Our transactions are recorded at the order and product level, our fixed costs at the store, year, and expense category level, and our employee salaries are tied to individual employees and their effective pay dates.

Instead of combining everything into one large table, we chose to keep these business processes separate to preserve their respective levels of granularity and avoid duplicating records or inflating our numbers.

We also chose not to incorporate the Promotions and Recurring Promotions tables into our current data model. However, as the stakeholder's business needs and desired insights evolve, they can expand the model to include these tables. For example, they may later want to explore the impact of promotional campaigns on sales and profitability. This keeps our model focused on the current business question while leaving room for future analysis.

This brings us back to our original business question. By connecting these three areas of the business through Store ID, we can analyze sales and costs at the store level and investigate potential warning signs leading up to the closures.

Now that we’ve established how our tables should relate to one another, it’s time to put our planning into practice. In Part 3, I’ll walk through our data cleaning and transformation process, the decisions we made along the way, and how we implemented our final data model in Tableau.