Fact table design for data ware house

26
SOFTWARE/WEB/MOBILE/DATABASE ARCHITECT, ENGINEER, AND DEVELOPER TORONTO, CANADA HTTP://SAYED.JUSTETC.NET HTTP://WWW.JUSTETC.NET Sayed Ahmed ata Warehouse Fact Table Design Logical Design of a Data Warehouse

Transcript of Fact table design for data ware house

Page 1: Fact table design for data ware house

SOFTWARE/WEB/MOBILE/DATABASE ARCHITECT, ENGINEER, AND DEVELOPER TORONTO, CANADAHTTP://SAYED.JUSTETC.NETHTTP://WWW.JUSTETC.NET

Sayed Ahmed

Data Warehouse Fact Table DesignLogical Design of a Data Warehouse

Page 2: Fact table design for data ware house

This is a video just for the sake of a video

I will not explain anything Just will walk through on some

presentation slides on Data Warehouse

Page 3: Fact table design for data ware house

OUR SERVICES Free Training and Educational

Services Training and Education in Bangla: 

Bangla.SaLearningSchool.com Training and Education in English:

www.SaLearningSchool.com English.SaLearningSchool.com http://sitestree.com

Ask a question and get answers:  Ask.JustEtc.net

Page 4: Fact table design for data ware house

FACT TABLE DESIGN Fact Table Design Topics

Define fact table column types Understand the additivity of a measure

i.e. for measure column type Handle many-to-many relationships in a

Star schema

Page 5: Fact table design for data ware house

FACT TABLE COLUMN TYPES Fact Table Column Types

Foreign keys Measures Lineage columns (optional) Business key columns

from the primary source table (optional) Surrogate keys

Page 6: Fact table design for data ware house

FACT TABLE COLUMNS - MEASURE Measure Column Type

Measure columns help with measurements useful for a specific business process

Measures columns are usually numeric And can be aggregated

Measure columns store values that are of interest to businesses such as

sales amount, order quantity, and discount amount

Page 7: Fact table design for data ware house

MEASURES Fact tables - Measures

Collection of measurements on a specific aspects of business

Measure columns sales amount, order quantity, and discount

amount.

Page 8: Fact table design for data ware house

FACT TABLE COLUMNS – FOREIGN KEY Foreign Key – Column Type

These are the columns as coming from Dimension Tables

Are the primary keys of Dimension Tables

Page 9: Fact table design for data ware house

FACT TABLE COLUMNS – SURROGATE KEYS Surrogate Key

Usually will comes from the primary dimension table (primary for the current fact table)

Usually one or two columns in a fact table are surrogate keys

Page 10: Fact table design for data ware house

SURROGATE KEYS FOR FACT TABLES OrderId and LineItemId are the surrogate keys as coming from the primary Source Order details tableOrderId and LineItemId columns will help For quick comparisons with source dataSurrogate keys are not a must in fact tables;

however, they help

Must read: http://www.kimballgroup.com/2006/07/design-tip-81-fact-table-surrogate-key/

Page 11: Fact table design for data ware house

LINEAGE COLUMNS IN FACT TABLES Lineage columns

Just as with dimension tables, these are strictly for auditing purposes

References: https://upsearch.com/implementing-a-data

-warehouse-fact-tables/

Page 12: Fact table design for data ware house

ADDITIVITY OF MEASURES The primary purpose of Data warehouse is

reporting, and forecasting Many times reports are aggregations such as sum Example: sales by quarter, by region, by product type

Many reports are usually aggregations Hence, fact tables will have some columns to assist

with that measures and aggregations for reporting These are the measures columns as we discussed before

The measures that you add will help in how you want to do the measures and reporting

Page 13: Fact table design for data ware house

TYPES OF ADDITIVITY OF MEASURES Types of Additivity of Measures

additive measures Semi-additive measures  non-additive measures

 

Page 14: Fact table design for data ware house

ADDITIVE, SEMI-ADDITIVE MEASURES Additive

If a measure can be summed across all dimensions Semi-additive

Sometimes, we can sum a measure across all dimensions except for time

such as account balance We can’t sum the account balance across the time

dimension  We would need to do something like take the average

instead or simply use the last value  Measures like this are called semi-additive measures

Page 15: Fact table design for data ware house

NON-ADDITIVE MEASURES Some measures can’t ever be summed These are called non-additive measures Such as discount percentages and

prices These are the non-additive measures

Page 16: Fact table design for data ware house

ADDITIVITY OF MEASURES IN SSAS SSAS has support for semi-additive and

non-additive measures  The SSAS database model

Business Intelligence Semantic Model (BISM). BISM includes way more additional metadata

than RDBMS SSAS has two types of storage

dimensional and  tabular

Page 17: Fact table design for data ware house

SSAS AND ADDITIVITY OF MEASURES Tabular storage works through tables

like a data warehouse does quicker to develop

The dimensional model more properly represents a cube

The dimensional model includes even more metadata than the tabular

model

Page 18: Fact table design for data ware house

SSAS AND ADDITIVITY OF MEASURES In BISM dimensional processing

SSAS offers semi-additive aggregate functions out of the box

For example, SSAS offers the LastNonEmpty aggregate

function which properly uses the SUM aggregate function

across all dimensions but time and defines the last known value as the

aggregate over time

Page 19: Fact table design for data ware house

SSAS AND ADDITIVITY OF MEASURES In the BISM tabular model

you use the Data Analysis Expression (DAX) language

The DAX language includes functions that let you build semi-additive expressions quite quickly as well

Page 20: Fact table design for data ware house

MANY TO MANY RELATIONSHIPS IN DATA WAREHOUSE

RDBMS Many to Many Relationship

Page 21: Fact table design for data ware house

MANY TO MANY IN RDBMS AND DW RDBMS Model as above image is ok, Because

Every internet sales will have multiple reasons Every reasons will have multiple internet sales

However, data warehouse has issues with such modeling because when using tools to build reporting the fact

table is expected to be on the many side In the above picture, fact table is on the one side In SSAS reporting, many times, we use tools that

build MDX queries that expect the schema to be perfectly in star or snow-flake schema

Page 22: Fact table design for data ware house

HOW CAN WE RESOLVE ... In SSAS with a BISM dimensional model

you can solve the problem by creating an intermediate dimension between both fact tables

Picture as below

Page 23: Fact table design for data ware house

MANY TO MANY RELATIONSHIP

Page 24: Fact table design for data ware house

DW MANY TO MANY You create it from the primary key of

theFactInternetSales table DimFactInternetSales.

put it on the “one” side of the relationships with both fact tables

Now, both fact tables are always on the “many” side of any relationship

However, the relationship between theFactInternetSales and the new DimFactInternetSales dimension is de facto one to one

Page 25: Fact table design for data ware house

THANK YOU

? http://ask.justetc.net

Page 26: Fact table design for data ware house

OUR SERVICES Free Training and Educational

Services Training and Education in Bangla: 

Bangla.SaLearningSchool.com Training and Education in English:

www.SaLearningSchool.com English.SaLearningSchool.com http://sitestree.com

Ask a question and get answers:  Ask.JustEtc.net