Data Visualization & BI

Chapter 6
BI Architecture and Data Modeling

Diploma in Business Analytics
Data Visualization & BI   •   Diploma

BI Architecture and Data Modeling

Introduction

Business intelligence (BI) is not simply the production of charts. It is an organizational capability that converts operational data into trusted information for monitoring, explanation, prediction, and decision-making. A BI ecosystem includes data-producing systems, integration processes, storage platforms, semantic definitions, analytical tools, users, and governance controls. Data modeling provides the structure that allows these components to work together consistently.

A poorly designed model can produce duplicated totals, slow reports, contradictory definitions, and loss of confidence. A well-designed model makes business questions easier to express, improves performance, supports self-service analysis, and provides a stable foundation for dashboards and analytics.

This chapter explains BI ecosystems and develops practical relational and dimensional models. Particular attention is given to grain, fact and dimension tables, star schemas, calculated measures, data quality, and governance.

Learning Objectives

By the end of this chapter, you should be able to:

  1. Describe the major components and data flows of a BI ecosystem.
  2. Distinguish operational, analytical, relational, and dimensional models.
  3. Define the grain of a fact table before selecting measures.
  4. Design a practical star schema containing fact and dimension tables.
  5. Create calculated measures while avoiding aggregation errors.
  6. Evaluate modeling decisions using performance, usability, governance, and ethical criteria.

1. The BI Ecosystem

A BI ecosystem is a connected set of technologies, processes, people, and rules that supports the movement of data from its source to a business decision. Typical components are shown below.

LayerMain purposeExamples
Source systemsCapture operational eventsPoint-of-sale, ERP, CRM, websites, sensors
IngestionMove data into analytical platformsBatch files, APIs, streaming pipelines
StorageRetain and organize dataData lake, warehouse, lakehouse
TransformationClean, integrate, and reshape dataSQL, ETL, ELT, data pipelines
Semantic layerDefine business entities and measuresMetrics model, tabular model, semantic dataset
PresentationEnable analysis and communicationReports, dashboards, notebooks
GovernanceControl meaning, quality, access, and useCatalogues, policies, lineage, security

The usual flow is source → ingestion → storage → transformation → semantic model → visualization. In practice, the flow is iterative. A dashboard requirement may reveal that a source system lacks a required field, causing a change to ingestion or operational data capture.

Operational and analytical workloads

Operational systems are optimized for recording transactions quickly and accurately. An order-entry system, for example, must create and update individual orders with low latency. Analytical systems are optimized for reading, aggregating, comparing, and filtering large volumes of historical data.

Operational databases commonly use normalized relational designs. Analytical databases may use dimensional models, columnar storage, aggregation structures, and partitioning. Attempting to use one design for every purpose often creates avoidable compromises.

Warehouse, lake, and lakehouse

A data warehouse stores integrated, structured data that has been prepared for reporting and analysis. A data lake stores data in many forms, including raw files, semi-structured events, and structured tables. A lakehouse combines lake-style storage flexibility with warehouse-style management and analytical performance. These labels describe architectural patterns rather than universally fixed products.

ETL and ELT

In extract-transform-load (ETL), data is transformed before it is loaded into the target platform. In extract-load-transform (ELT), data is first loaded and then transformed using the processing capabilities of the target platform. Both approaches can be appropriate. The choice depends on data volume, latency, platform capabilities, security, and the need to preserve raw data.

2. Relational Data Modeling

A relational model represents data in tables consisting of rows and columns. Each row represents an occurrence of an entity or relationship, and each column represents an attribute. A primary key uniquely identifies a row. A foreign key references a key in another table and establishes a relationship.

For example, a normalized sales database might contain:

  • Customer(CustomerID, Name, Segment)
  • Product(ProductID, ProductName, Category)
  • SalesOrder(OrderID, CustomerID, OrderDate)
  • SalesOrderLine(OrderID, ProductID, Quantity, UnitPrice)

The SalesOrderLine table resolves the many-to-many relationship between orders and products. One order can contain many products, and one product can occur in many orders.

Normalization

Normalization reduces unnecessary repetition and update anomalies. In simplified terms:

  • First normal form requires atomic values and no repeating groups.
  • Second normal form requires non-key attributes to depend on the whole composite key.
  • Third normal form requires non-key attributes to depend only on the key, not on another non-key attribute.

A normalized operational model might store a product category once in Product rather than repeating it on every order line. This improves consistency during updates. However, analytical queries may require several joins. For reporting, a dimensional model often provides a more usable balance between controlled redundancy and query simplicity.

Keys and identifiers

A natural key has business meaning, such as a customer number. A surrogate key is an artificial identifier, often an integer, generated within the data warehouse. Surrogate keys are useful when source identifiers change, when multiple systems use overlapping identifiers, or when historical versions of a dimension must be retained.

A key should be stable, unique, and consistently managed. A foreign key should not silently fail to match its parent. Unknown, not applicable, and unavailable values should be distinguished where their meanings differ.

3. Dimensional Modeling

Dimensional modeling organizes data around measurable business events and the descriptive contexts used to analyze those events. Its central structures are fact tables and dimension tables.

A fact table records events, observations, or periodic states. It normally contains foreign keys to dimensions and numeric measures. A dimension table contains descriptive attributes used for filtering, grouping, and labeling.

For a retail sale:

  • Fact: a sale line, with quantity, price, discount, and cost.
  • Dimensions: date, product, store, customer, promotion, and employee.

Dimensional models are popular because they map naturally to business questions such as “What was revenue by product category and month?” or “Which stores exceeded their target?”

The grain: the most important design decision

The grain states exactly what one row in a fact table represents. Examples include:

  • One row per product per order line.
  • One row per store per day.
  • One row per customer account per month.
  • One row per shipment event.

The grain must be declared before measures are selected. If the grain is one row per order line, quantity and line revenue are additive across orders and products. An order-level shipping charge may not be safely repeated on every line because summing it would overstate shipping revenue.

A reliable design statement is: “One row represents one ___.” If the blank cannot be completed precisely, the model is not ready.

Additivity of measures

Measures differ in how they can be aggregated.

TypeMeaningExampleSafe aggregation
AdditiveCan be summed across all relevant dimensionsQuantity, revenueSum across time, product, and location
Semi-additiveCan be summed across some dimensions but not othersAccount balance, inventory levelSum across accounts, but usually not across time
Non-additiveCannot be meaningfully summedMargin percentage, unit priceRecalculate from components

A percentage should generally be calculated from its numerator and denominator, not averaged from row-level percentages. For example, overall margin percentage is calculated from total margin divided by total revenue.

4. Star Schemas and Related Structures

A star schema contains a central fact table directly connected to denormalized dimension tables. It is called a star because the fact table is surrounded by dimensions.

Margin = Revenue − Cost

where Revenue and Cost use the same currency and the same grain or are aggregated consistently before subtraction.

A snowflake schema normalizes parts of the dimensions. For example, Product may connect to Subcategory, which connects to Category. Snowflaking can reduce repeated storage and support complex hierarchies, but it introduces more joins and may be less intuitive for report authors. A star schema is usually preferred for dashboard usability unless normalization provides a clear benefit.

A fact constellation, or galaxy schema, contains multiple fact tables that share conformed dimensions. For example, Sales and Returns may share Date, Product, Store, and Customer dimensions. Conformed dimensions ensure that “Product Category” means the same thing across subject areas.

Slowly changing dimensions

Dimension attributes change over time. A customer may change segment, or a product may move to another category. Common approaches include:

  • Type 1: overwrite the old value. This is simple but loses history.
  • Type 2: create a new dimension row for the new version, usually with effective dates and a current-row indicator. This preserves history.
  • Type 3: retain selected prior values in additional columns. This supports limited comparison but is less flexible.

Type 2 is appropriate when historical reports must reflect the attribute that was valid when an event occurred. It requires fact rows to reference the correct version of the dimension.

5. Building a Practical Model

A disciplined modeling process reduces errors.

Step 1: Identify the business process

Start with a process, not a chart. Examples include sales, purchasing, inventory, customer service, or website visits. Define the decisions the process must support.

Step 2: Declare the grain

Write a precise sentence describing one fact row. Confirm that all stakeholders interpret it identically.

Step 3: Identify dimensions

List the descriptive perspectives required by users: date, product, location, customer, channel, promotion, or employee. Each dimension should have a clear business meaning and appropriate keys.

Step 4: Identify facts and classify them

Select measurements that exist at the declared grain. Record their units, source, calculation rule, and additivity. Do not place a measure in a fact table merely because it appears on a source screen.

Step 5: Define relationships and integrity rules

Specify cardinality, key constraints, handling of missing values, and treatment of late-arriving data. A fact row with no matching product should be assigned to a controlled unknown member rather than disappearing from reports.

Step 6: Validate with business questions

Test the model using representative questions. Can users calculate sales by month, category, and store without double counting? Can they distinguish orders from order lines? Can they compare current and historical categories?

Illustrative retail star schema

Assume a retailer wants to analyze sales by date, product, store, customer, and promotion. The fact table has one row per order line.

FactSales

ColumnRole
SalesLineKeySurrogate row identifier
DateKeyForeign key to DimDate
ProductKeyForeign key to DimProduct
StoreKeyForeign key to DimStore
CustomerKeyForeign key to DimCustomer
PromotionKeyForeign key to DimPromotion
QuantityUnits sold
UnitPricePrice per unit
DiscountAmountDiscount for the line
UnitCostCost per unit

DimProduct may contain ProductKey, ProductCode, ProductName, Brand, Subcategory, Category, and Supplier. DimDate may contain DateKey, CalendarDate, Day, Month, Quarter, Year, FiscalPeriod, and IsHoliday. Similar dimensions describe stores, customers, and promotions.

If Quantity is 3, UnitPrice is 20, DiscountAmount is 5, and UnitCost is 12 per unit, then:

GrossSales = Quantity × UnitPrice = 3 × 20 = 60
NetSales = GrossSales − DiscountAmount = 60 − 5 = 55
Cost = Quantity × UnitCost = 3 × 12 = 36
Margin = NetSales − Cost = 55 − 36 = 19

The currency unit for all monetary values must be the same. These calculations assume that discount is recorded as a monetary amount for the line and that UnitCost applies to every unit in the line.

6. Calculated Measures

A calculated measure is a reusable expression evaluated in the current filter context. It differs from a calculated column, which is usually computed and stored for each row. Measures are generally preferable for aggregations because they respond to filters such as date, product, and store.

Common measures include:

Total Quantity = ∑ Quantity
Total Net Sales = ∑ (Quantity × UnitPrice − DiscountAmount)
Total Cost = ∑ (Quantity × UnitCost)
Gross Margin = Total Net Sales − Total Cost
Margin Percentage = (Gross Margin ÷ Total Net Sales) × 100%

The summation symbol ∑ means that the expression is evaluated over the relevant fact rows. Margin Percentage is valid when Total Net Sales is non-zero. It should be recalculated at the selected aggregation level, rather than averaged from row-level percentages.

For example, suppose two product lines have net sales of 100 and 900, and margins of 20 and 90. The row-level margin percentages are 20% and 10%; their simple average is 15%. The correct overall margin percentage is:

(20 + 90) ÷ (100 + 900) × 100% = 11%

This illustrates why weighted results must be based on totals.

Time-based measures

Time intelligence requires a complete, marked date dimension with one row per date and an appropriate relationship to the fact table. Year-to-date sales can be defined as the sum from the beginning of the selected year through the current date. A prior-year comparison must align comparable periods and account for fiscal calendars where relevant.

Ratios and division by zero

A ratio should define its denominator and its behavior when the denominator is zero or missing. A dashboard may display “Not available” rather than zero, because zero implies a measured absence while unavailable indicates that calculation was not possible.

7. Performance and Semantic Design

A logically correct model can still be difficult to use or slow to query. Important design considerations include:

  • Reduce unnecessary columns, particularly high-cardinality text fields in fact tables.
  • Use integer surrogate keys where appropriate.
  • Partition large facts by date when the platform supports it.
  • Create aggregates only for demonstrated performance needs.
  • Keep relationships simple and avoid ambiguous many-to-many paths.
  • Use consistent naming, units, formats, and descriptions.
  • Separate technical fields from business-facing fields.

A semantic layer should expose business concepts rather than merely database columns. “Net Sales” should have one governed definition, owner, currency convention, and documentation. Certified measures reduce the risk that different analysts create incompatible versions of the same metric.

8. Governance, Security, and Ethics

BI governance determines who may access data, who owns definitions, how quality is monitored, and how changes are approved. Key controls include data lineage, cataloguing, validation rules, access logs, retention schedules, and role-based access.

Row-level security may restrict a regional manager to the stores in that manager’s region. It must be tested carefully: security applied only in a dashboard but not in an underlying dataset may expose sensitive information through exports or alternative tools.

Personal data requires particular care. Organizations should collect only what is necessary, define legitimate purposes, restrict access, protect data in transit and at rest, and follow applicable privacy laws and organizational policies. Customer segmentation can create unfair outcomes if historical data reflects discrimination or if proxy variables reproduce protected characteristics.

Data quality should be assessed across dimensions such as accuracy, completeness, consistency, timeliness, validity, and uniqueness. A dashboard should not present false precision. If source data is incomplete, the limitation should be visible to decision-makers.

9. Applied Case: Regional Retail Performance

Background

The illustrative Northstar Retail Group operates 40 stores and an online channel. Executives receive different sales totals from finance, marketing, and regional operations. Reports also disagree about product categories because one system uses current categories while another uses categories at the date of sale.

Problem

The organization has a normalized operational database, spreadsheet extracts, and a separate returns file. Analysts join these sources independently. Order-level shipping charges are repeated on each order line, and returns are sometimes counted as negative sales and sometimes excluded.

Analysis

The team begins by documenting business definitions. Sales is defined as completed order-line value less line discounts, while returns are reported as a separate process. The proposed sales grain is one row per completed order line. The return grain is one row per returned item event. Shipping is modeled separately because it is recorded at order level.

The team identifies shared dimensions: Date, Product, Store, Customer, and Channel. Product history requires a Type 2 dimension because management wants reports to preserve the category valid at the time of sale.

Approach and solution

The team builds FactSales, FactReturns, and FactShipping, linked through conformed dimensions. A controlled unknown member is added to each dimension for unmatched source records. Measures are governed as follows:

  • Net Sales = gross line sales less line discounts.
  • Return Value = value of returned items.
  • Net Merchandise Value = Net Sales less Return Value.
  • Gross Margin = Net Sales less cost of sold items.
  • Average Order Value = Net Sales divided by distinct completed orders, when the denominator is non-zero.

Because FactSales is at line grain, order-level shipping is not copied to each line. Shipping is analyzed from FactShipping or allocated using a documented allocation rule when a combined profitability view is required.

Outcome

After reconciliation, finance and operations use the same definitions. Historical category reports remain stable, and regional managers can view only authorized stores. Data quality checks identify unmatched products and delayed returns rather than silently excluding them.

Learning points

The main improvement did not come from a more attractive dashboard. It came from declaring grain, separating business processes, using conformed dimensions, governing measures, and documenting exceptions. Architecture and modeling decisions directly affected managerial trust.

10. Common Errors and Best Practices

Common errors include mixing grains in one fact table, joining fact tables directly and multiplying rows, summing semi-additive balances across time, averaging percentages, using ambiguous date relationships, and allowing each analyst to redefine core metrics.

Best practices are to begin with business processes, declare grain explicitly, separate facts by process when grains differ, use conformed dimensions, preserve source data and lineage, validate totals against trusted controls, and test models with realistic questions. Documentation should include definitions, units, refresh timing, owners, assumptions, and known limitations.

Contemporary BI platforms increasingly automate data preparation, generate natural-language queries, and use AI to recommend visualizations or detect anomalies. These capabilities do not remove the need for modeling. An AI-generated answer is only as reliable as the data, definitions, permissions, and context behind it. Human review remains essential for consequential decisions.

Chapter Summary

A BI ecosystem connects source systems, ingestion, storage, transformation, semantic definitions, visualization, and governance. Operational relational models emphasize transaction integrity and reduced redundancy, while dimensional models emphasize analytical usability and performance. A star schema places a fact table at the center and connects it directly to descriptive dimensions.

The grain of a fact table is the foundation of correct modeling. Measures must be selected at that grain and classified as additive, semi-additive, or non-additive. Calculated measures should use governed definitions and recompute ratios from appropriate totals. Slowly changing dimensions preserve or overwrite history according to business needs. Security, privacy, quality, lineage, and ethical use are integral to BI rather than optional additions.

Key Terms

BI ecosystem: The connected technologies, processes, people, and controls that turn data into decisions.

Data warehouse: An integrated analytical store containing structured, historical data.

Data lake: A storage environment that retains data in multiple formats, often including raw data.

ETL: Extract, transform, and load; transformation occurs before loading.

ELT: Extract, load, and transform; transformation occurs after loading.

Relational model: A table-based model using rows, columns, keys, and relationships.

Normalization: Organizing data to reduce redundancy and update anomalies.

Fact table: A table recording measurable events, states, or observations.

Dimension table: A table containing descriptive context for analyzing facts.

Grain: The precise meaning of one row in a fact table.

Star schema: A dimensional model with a central fact table and directly connected dimensions.

Snowflake schema: A dimensional model with normalized dimension structures.

Surrogate key: A warehouse-generated identifier without direct business meaning.

Conformed dimension: A shared dimension with consistent meaning across fact tables.

Additive measure: A measure that can be summed across relevant dimensions.

Semi-additive measure: A measure that can be summed across some dimensions but not all.

Slowly changing dimension: A method for managing changes to dimension attributes over time.

Semantic layer: A business-facing layer that defines entities, relationships, and measures.

Row-level security: A control that restricts records according to the user’s authorization.

Data lineage: Documentation of where data originated and how it was transformed.

Review Questions

Short Answer Questions

  1. What are the major layers of a BI ecosystem?
  2. Why is grain declared before measures are selected?
  3. Distinguish a fact table from a dimension table.
  4. What is the difference between ETL and ELT?
  5. Why should percentages usually be recalculated from totals?

Long Answer Questions

  1. Compare normalized relational modeling with dimensional modeling, including the strengths and limitations of each.
  2. Explain additive, semi-additive, and non-additive measures using suitable business examples.
  3. Describe the process of designing a star schema for a retail sales process.
  4. Explain Type 1 and Type 2 slowly changing dimensions and identify situations in which each is appropriate.
  5. Discuss how governance, privacy, security, and data quality affect trust in BI outputs.

Analytical / Application Questions

  1. A sales fact table has one row per order line, but order-level shipping is repeated on every line. Diagnose the error and propose a corrected model.
  2. Design the grain, dimensions, and measures for a monthly inventory snapshot. Which measures are semi-additive, and how should time aggregation be handled?
  3. Two departments report different margin percentages because one averages line percentages and the other divides total margin by total sales. Determine which method is appropriate and explain why.

Multiple Choice Questions with Answers

Question 1

Which statement best defines the grain of a fact table?

A. The number of columns in the table

B. The precise meaning of one row in the table

C. The storage size of the table

D. The number of dimensions connected to the table

Correct Answer: B. The precise meaning of one row in the table

Question 2

Which measure is normally semi-additive?

A. Quantity sold

B. Net sales

C. End-of-day inventory balance

D. Discount amount

Correct Answer: C. End-of-day inventory balance

Question 3

What is the main purpose of a dimension table?

A. To store descriptive context for analyzing facts

B. To replace all source systems

C. To store only calculated percentages

D. To enforce encryption on every report

Correct Answer: A. To store descriptive context for analyzing facts

Question 4

In a Type 2 slowly changing dimension, what normally happens when an attribute changes?

A. All fact rows are deleted

B. The old value is always overwritten

C. A new dimension version is created to preserve history

D. The dimension is converted into a fact table

Correct Answer: C. A new dimension version is created to preserve history

Question 5

If quantity is 4, unit price is 25, and discount is 10, what is net sales?

A. 90

B. 100

C. 110

D. 120

Correct Answer: A. 90

Question 6

Why can averaging row-level margin percentages produce a misleading result?

A. Percentages have no units

B. Rows may have different sales amounts and should be weighted by their denominators

C. Margins cannot be calculated from revenue

D. Dimensions prevent aggregation

Correct Answer: B. Rows may have different sales amounts and should be weighted by their denominators

Question 7

Which structure is most characteristic of a star schema?

A. A central fact table directly connected to dimension tables

B. Only one table with no keys

C. A chain of unrelated spreadsheets

D. A dimension table containing no descriptive attributes

Correct Answer: A. A central fact table directly connected to dimension tables

Question 8

What is a conformed dimension?

A. A dimension used consistently across multiple fact tables

B. A dimension that contains only dates

C. A dimension with no primary key

D. A temporary source file

Correct Answer: A. A dimension used consistently across multiple fact tables

Question 9

Which practice best prevents order-level shipping from being double-counted in an order-line fact table?

A. Repeat shipping on every line

B. Ignore shipping in every report

C. Model shipping at its proper order-level grain or document a valid allocation

D. Convert shipping into a product category

Correct Answer: C. Model shipping at its proper order-level grain or document a valid allocation

Question 10

What does row-level security do?

A. Changes the grain of a fact table

B. Restricts records according to a user’s authorization

C. Normalizes every dimension

D. Automatically corrects inaccurate source data

Correct Answer: B. Restricts records according to a user’s authorization

Data Visualization & BI
Chapter 6 of 14