Uploaded by vezendi szabolcs

LWTN Data Modeling

advertisement
LWTN Data Modeling
Mitchell Pearson
About Mitchell
Highlights:
• Consultant and Trainer
• Pragmatic Works 10 years
• Author
• Blogs at MitchellPearson.com
• Family: Wife & 3 kids
• Table Top Games
• YouTube.com/c/PragmaticWorks
• mpearson@pragmaticworks.com
Let’s Review
Logistics
Class Files
Course Completion Certification
11:00am – 2:00pm (Eastern)
Break – 12:25 (15 minute break)
Agenda
Dimensional Modeling
Facts and Dimensions
Star Schema
Creating a Data Model in Power BI
Multiple Fact Tables
Aggregate Tables
Calculation Groups (Role Playing 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)
2)
3)
4)
What are you measuring?
What types of business problems are you trying to solve?
How much data are you working with?
What are your data sources?
Attributes of a Good Data Model
Can be easily understood and consumed
Large data changes are scalable
Provides predictable performance
Is flexible and adaptable, but not at the
expense of the other attributes
What is easier with a good data model?
Managing Storage constraints
Performance Tuning
Managing Row Level Security
Authoring DAX
Everything!
Star Schema
1
Many
1
Fact table in the middle
Surrounded by Dims
1
Looks like a ‘Star’
Fact table is the “Many”
side of the (one to many)
relationship
Snowflake Schema
Dim
Fact
Dim
Center is a Star schema
Fact table in middle
Surrounded by Dims
Dim
Snowflake
Flake
Dims “snowflake” off of other Dims
If you have many, it looks like a
‘Snowflake’
Dim or Fact tables can be the “Many”
side of the relationship
Model Types
Logical
Physical
Sales
Fact Sales
Sales
Transaction Number
Product
Sale Date
Sales Amount
Fact Sales ID [int] IDENTITY(1,1) NOT NULL
Transaction Number [varchar](64) NULL
Product ID [int] NOT NULL
Sale Date ID [int] NOT NULL
Sales Amount [decimal](19,2) NULL
Products
Product
Conceptual
UPC
Name
Description
Product
Product ID [int] IDENTITY(1,1) NOT NULL
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:
Dim
Table
Dim
Table
By Month
By Customer
By Geo
Relationships
Relationships
Connection between 2
tables (usually fact & Dim
tables) using columns
from each
Types of Relationships
Relationships
1 to Many
1 to 1
Many to Many
(with a bridge table)
Dimensional Model - Structure
Highly Denormalized
Tables merged logically for
reporting
Table Types
Only Facts and Dimensions
Necessary Fields Only
No Unnecessary Attributes
OR
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!!
Download