LWTN Data Modeling
LWTN Data Modeling
Mitchell Pearson
About Mitchell
Highlights:
• Author
• Blogs at MitchellPearson.com
• YouTube.com/c/PragmaticWorks
• mpearson@pragmaticworks.com
Let’s Review
Logistics
Class Files
Aggregate Tables
Storage Modes
Recommended Books
Data Warehouse Toolkit
- Ralph Kimball
Star Schema
- Christopher Adamson
Dimensional Modeling
What is a Data Model?
Things to consider….
1) What are you measuring?
2) What types of business problems are you trying to solve?
3) How much data are you working with?
4) What are your data sources?
Attributes of a Good Data Model
Can be easily understood and consumed
Performance Tuning
Authoring DAX
Everything!
Star Schema
1
Many Fact table in the middle
1
Surrounded by Dims
Products Product
Product
UPC
Name Product ID [int] IDENTITY(1,1) NOT NULL
Description UPC Code [varchar](12) NOT NULL
Product Name [varchar](128) NOT NULL
Product Description [varchar](512) NULL
Conceptual
Model
Dimensional Model Design
Dimensional Model Basics | Model Types
Dimensional Model – Terminology
Dimensional Model
Organizes the data so it is easy to retrieve for
reporting purposes
Fact Table
A fact is an event that may or may not include
measures.
Dimension Table
Category of information, or a noun, descriptive
Attribute (column in dimension table)
Descriptor of the object
Fact Tables
Fact Table
Contains Measures
(or items to be aggregated)
of a business process
Examples
Claim Amount, Screenings, Total
Claims, Cost
Measures
Usually sliceable
Examples:
By Month, By Member
Fact
Table
Fact Tables
Fact
A fact is an event that may or may not
include measures
Granularity
Lowest level of information that will
be stored in the fact table, or the
values that would make the row
distinct compared to all other rows
Dimensions
Dim Table
A Dim (or Dimension)
table contains descriptive
attributes that define how a
fact should roll up
Examples:
By Month
By Customer
Dim Dim By Geo
Table Table
Relationships
Relationships
Connection between 2
tables (usually fact & Dim
tables) using columns
from each
Types of Relationships
1 to Many
1 to 1
Many to Many
(with a bridge table)
Relationships
Dimensional Model - Structure
Highly Denormalized
Tables merged logically for
reporting
Table Types
OR
Only Facts and Dimensions
Necessary Fields Only
No Unnecessary Attributes
Defining Dimension
• “Dimensions provide the “who, what, where, when, why, and how” context
surrounding a business process event.
• - Ralph Kimball
Dimension Architecture
• Wide Table
• Surrogate Key (Unique ID)
• Natural Key
• Best Attributes are Desciptive
• Start Date / End Date
• Flags
DEMO TIME!!