SlideShare a Scribd company logo
2
Most read
4
Most read
CREATING DATA WAREHOUSE
USING POWER QUERY & POWER PIVOT
DATA WAREHOUSE OF MEANINGFUL INFORMATION ON ROAD ACCIDENTS
Author: Anthony Mok
Date: 18 Nov 2023
Email: xxiaohao@yahoo.com
WHAT IS POWER QUERY & POWER PIVOT
Excel Power Query
A data
transformation and
preparation tool
that simplifies the
process of
importing, shaping,
and analysing data
from various
sources
Excel Power Pivot
A data modeling
add-in for Excel
that enables us to
create
sophisticated data
models, analyse
large datasets, and
perform complex
calculations
PROJECT’S CONTEXT, OBJECTIVE & STRATEGIES
Context
Social Enterprise, from a neighboring
country which provides ambulatory
services, has collected data on road
accidents and is keen to use the data
to inform on its resource deployment.
It has stored the data into three files:
‘Accidents.xlsx’, ‘Casualties.xlsx’ and
‘Vehicles.txt’
Objective
Create a data warehouse
containing meaningful
information on road
accidents
Strategies
 Import file and transform
data
 Create queries as a new
table
 Merge these tables
 Summary table
 Power Pivot and create a
data model
IMPORT 1ST FILE, TRANSFORM DATA & CREATE 1ST POWER QUERY
 The file: ‘data warehouse on road
accidents.xlsx’, was created in MS Excel, and
the ‘Accidents0515 sheet’ from the
‘Accidents.xlsx’ file was imported into this
data warehouse.xlsx file to conduct data
transformation
 In the ‘Day_of_Week’ column, in the
‘Accidents0515 sheet’, records with value of
-1 were excluded since this is an impossible
value
 Format of the ‘Date’ column was changed to
text since this is not a numerical data
 In the ‘Speed_limit’ column, only records that
are 40 and above were selected
 When loading the ‘Accidents0515’ sheet into
Power Pivot, ‘Only Create Connection’ option
was chosen since this would be combined
with the 2nd Power Query to form a new query
IMPORT 2ND FILE, TRANSFORM DATA & CREATE 2ND POWER QUERY
▪ The ‘Vehicles.xlsx’ file was imported
into the MS Excel file: ‘data warehouse
on road accidents.xlsx’
▪ Records with value of -1 in the
‘Age_of_Vehicle’ and ‘Age_of_Driver’
columns were excluded since this is an
impossible value
 When loading the ‘Vehicles0515’ sheet
into Power Pivot, ‘Only Create
Connection’ option was chosen since
this would be combined with the 1st
Power Query already created to form a
new combined query
MERGE TWO QUERIES TO CREATE NEW COMBINED POWER QUERY
▪ The ‘Accident0515’ and ‘Vehicle0515’
queries were merged to create the new
‘Vehicles with Accident History’ query
▪ The ‘Accident_index’ was used as the
key to merge these two queries
▪ When loading the ‘Vehicles with
Accident History’ table, ‘Only Create
Connection’ option was chosen since
there is one more Power Query to
create before loading these 3 queries
into Power Pivot as a data model
PREPARE SUMMARY TABLE TO CREATE FINAL POWER QUERY
▪ The ‘Casualties.xlsx’ file was imported into the
MS Excel file: ‘data warehouse on road
accidents.xlsx’
▪ The ‘Summary Table of Total Pedestrian Cases
By Casualty Severity Types’ was prepared,
through Power Pivot, with the following columns:
▪ Total Number of Accidents
▪ Average Age of Casualty (using the variable:
‘Age_of_Casualty’)
▪ Total Pedestrian Cases (using the variable:
‘Pedestrian Indicator’) for each
‘Casualty_Severity’ type (using the variable:
‘Casualty_Severity’)
▪ When loading the “Casualties0515” sheet, ‘Only
Create Connection’ option was chosen since this
is the final Power Query to create before loading
this and two previously created queries into
Power Pivot as a data model
CREATE DATA MODEL FROM 3 POWER QUERIES
Loading Power Queries into
Power Pivot as Data Model
The ‘Accidents 0515’, ‘vehicles05151 and
‘causalities0515’ Power Queries were loaded into
Power Pivot as a data model
Excel Power Pivot
To complete the data modelling process, at the Diagram View module in
the Power Pivot workspace, the four tables were linked, using the:
 ‘Accident_index’ key for the ‘Accidents 0515’, ‘vehicles0515’ and
‘causalities0515’ tables,
 ‘Vehicle_Type’ key for the ‘vehicles0515’ and ‘Vehicle_Description’
tables (the “F1” key in the ‘Vehicle_Description’ table is the
‘Vehicle_Type’ key)
CREATING DATA WAREHOUSE
USING POWER QUERY & POWER PIVOT
DATA WAREHOUSE OF MEANINGFUL INFORMATION ON ROAD ACCIDENTS
Author: Anthony Mok
Date: 18 Nov 2023
Email: xxiaohao@yahoo.com

More Related Content

PDF
AutomobileDataAnalysis.pdf
PPTX
BNSF Train Scoring System (Machine Vision project)
PDF
Handouts how to use microsoft access to combine cost and usage data for ejour...
DOCX
Exp22_Excel_Ch04_Cumulative - Insurance Claims 1.2_Instructions..docx
DOCX
College Construction Projects and EventsProject Description I.docx
PPTX
Difference in Differences - Does Strict Speed Limit Restrictions Reduce Road ...
PDF
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
PDF
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
AutomobileDataAnalysis.pdf
BNSF Train Scoring System (Machine Vision project)
Handouts how to use microsoft access to combine cost and usage data for ejour...
Exp22_Excel_Ch04_Cumulative - Insurance Claims 1.2_Instructions..docx
College Construction Projects and EventsProject Description I.docx
Difference in Differences - Does Strict Speed Limit Restrictions Reduce Road ...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...

More from ThinkInnovation (17)

PDF
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
PDF
Ordinary Least Square Regression & Stage-2 Regression - Factors Influencing M...
PDF
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...
PDF
Decision Making Under Uncertainty - Predict the Chances of a Person Suffering...
PDF
Decision Making Under Uncertainty - Is It Better Off Joining a Partnership or...
PDF
Predictive Analysis - Using Insight-informed Data to Plan Inventory in Next 6...
PDF
Decision Making Under Uncertainty - Decide Whether Or Not to Take Precautions
PDF
Optimal Decision Making - Cost Reduction in Logistics
PDF
Create Data Model & Conduct Visualisation in Power BI Desktop
PDF
Using DAX & Time-based Analysis in Data Warehouse
PPTX
Unlocking New Insights Into the World of European Soccer Through the European...
PPT
Breakfast Talk - Manage Projects
PPT
Think innovation issue 4 share - scamper
PPT
PPT
Reverse Assumption Method
PPT
Psyche of Facilitation - The New Language of Facilitating Conversations
PPT
Visual Connection - Ideation Through Word Association
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Ordinary Least Square Regression & Stage-2 Regression - Factors Influencing M...
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...
Decision Making Under Uncertainty - Predict the Chances of a Person Suffering...
Decision Making Under Uncertainty - Is It Better Off Joining a Partnership or...
Predictive Analysis - Using Insight-informed Data to Plan Inventory in Next 6...
Decision Making Under Uncertainty - Decide Whether Or Not to Take Precautions
Optimal Decision Making - Cost Reduction in Logistics
Create Data Model & Conduct Visualisation in Power BI Desktop
Using DAX & Time-based Analysis in Data Warehouse
Unlocking New Insights Into the World of European Soccer Through the European...
Breakfast Talk - Manage Projects
Think innovation issue 4 share - scamper
Reverse Assumption Method
Psyche of Facilitation - The New Language of Facilitating Conversations
Visual Connection - Ideation Through Word Association
Ad

Recently uploaded (20)

PDF
REAL ILLUMINATI AGENT IN KAMPALA UGANDA CALL ON+256765750853/0705037305
PPTX
A Complete Guide to Streamlining Business Processes
PPTX
Topic 5 Presentation 5 Lesson 5 Corporate Fin
PDF
Optimise Shopper Experiences with a Strong Data Estate.pdf
PPTX
modul_python (1).pptx for professional and student
PPT
lectureusjsjdhdsjjshdshshddhdhddhhd1.ppt
PPTX
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
PDF
Global Data and Analytics Market Outlook Report
PPTX
SAP 2 completion done . PRESENTATION.pptx
PPTX
sac 451hinhgsgshssjsjsjheegdggeegegdggddgeg.pptx
PPTX
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
PDF
Jean-Georges Perrin - Spark in Action, Second Edition (2020, Manning Publicat...
PDF
OneRead_20250728_1808.pdfhdhddhshahwhwwjjaaja
PPTX
New ISO 27001_2022 standard and the changes
PPTX
Managing Community Partner Relationships
PPTX
Qualitative Qantitative and Mixed Methods.pptx
PDF
Microsoft Core Cloud Services powerpoint
PPTX
Leprosy and NLEP programme community medicine
PDF
Capcut Pro Crack For PC Latest Version {Fully Unlocked 2025}
DOCX
Factor Analysis Word Document Presentation
REAL ILLUMINATI AGENT IN KAMPALA UGANDA CALL ON+256765750853/0705037305
A Complete Guide to Streamlining Business Processes
Topic 5 Presentation 5 Lesson 5 Corporate Fin
Optimise Shopper Experiences with a Strong Data Estate.pdf
modul_python (1).pptx for professional and student
lectureusjsjdhdsjjshdshshddhdhddhhd1.ppt
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
Global Data and Analytics Market Outlook Report
SAP 2 completion done . PRESENTATION.pptx
sac 451hinhgsgshssjsjsjheegdggeegegdggddgeg.pptx
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
Jean-Georges Perrin - Spark in Action, Second Edition (2020, Manning Publicat...
OneRead_20250728_1808.pdfhdhddhshahwhwwjjaaja
New ISO 27001_2022 standard and the changes
Managing Community Partner Relationships
Qualitative Qantitative and Mixed Methods.pptx
Microsoft Core Cloud Services powerpoint
Leprosy and NLEP programme community medicine
Capcut Pro Crack For PC Latest Version {Fully Unlocked 2025}
Factor Analysis Word Document Presentation
Ad

Creating Data Warehouse Using Power Query & Power Pivot

  • 1. CREATING DATA WAREHOUSE USING POWER QUERY & POWER PIVOT DATA WAREHOUSE OF MEANINGFUL INFORMATION ON ROAD ACCIDENTS Author: Anthony Mok Date: 18 Nov 2023 Email: xxiaohao@yahoo.com
  • 2. WHAT IS POWER QUERY & POWER PIVOT Excel Power Query A data transformation and preparation tool that simplifies the process of importing, shaping, and analysing data from various sources Excel Power Pivot A data modeling add-in for Excel that enables us to create sophisticated data models, analyse large datasets, and perform complex calculations
  • 3. PROJECT’S CONTEXT, OBJECTIVE & STRATEGIES Context Social Enterprise, from a neighboring country which provides ambulatory services, has collected data on road accidents and is keen to use the data to inform on its resource deployment. It has stored the data into three files: ‘Accidents.xlsx’, ‘Casualties.xlsx’ and ‘Vehicles.txt’ Objective Create a data warehouse containing meaningful information on road accidents Strategies  Import file and transform data  Create queries as a new table  Merge these tables  Summary table  Power Pivot and create a data model
  • 4. IMPORT 1ST FILE, TRANSFORM DATA & CREATE 1ST POWER QUERY  The file: ‘data warehouse on road accidents.xlsx’, was created in MS Excel, and the ‘Accidents0515 sheet’ from the ‘Accidents.xlsx’ file was imported into this data warehouse.xlsx file to conduct data transformation  In the ‘Day_of_Week’ column, in the ‘Accidents0515 sheet’, records with value of -1 were excluded since this is an impossible value  Format of the ‘Date’ column was changed to text since this is not a numerical data  In the ‘Speed_limit’ column, only records that are 40 and above were selected  When loading the ‘Accidents0515’ sheet into Power Pivot, ‘Only Create Connection’ option was chosen since this would be combined with the 2nd Power Query to form a new query
  • 5. IMPORT 2ND FILE, TRANSFORM DATA & CREATE 2ND POWER QUERY ▪ The ‘Vehicles.xlsx’ file was imported into the MS Excel file: ‘data warehouse on road accidents.xlsx’ ▪ Records with value of -1 in the ‘Age_of_Vehicle’ and ‘Age_of_Driver’ columns were excluded since this is an impossible value  When loading the ‘Vehicles0515’ sheet into Power Pivot, ‘Only Create Connection’ option was chosen since this would be combined with the 1st Power Query already created to form a new combined query
  • 6. MERGE TWO QUERIES TO CREATE NEW COMBINED POWER QUERY ▪ The ‘Accident0515’ and ‘Vehicle0515’ queries were merged to create the new ‘Vehicles with Accident History’ query ▪ The ‘Accident_index’ was used as the key to merge these two queries ▪ When loading the ‘Vehicles with Accident History’ table, ‘Only Create Connection’ option was chosen since there is one more Power Query to create before loading these 3 queries into Power Pivot as a data model
  • 7. PREPARE SUMMARY TABLE TO CREATE FINAL POWER QUERY ▪ The ‘Casualties.xlsx’ file was imported into the MS Excel file: ‘data warehouse on road accidents.xlsx’ ▪ The ‘Summary Table of Total Pedestrian Cases By Casualty Severity Types’ was prepared, through Power Pivot, with the following columns: ▪ Total Number of Accidents ▪ Average Age of Casualty (using the variable: ‘Age_of_Casualty’) ▪ Total Pedestrian Cases (using the variable: ‘Pedestrian Indicator’) for each ‘Casualty_Severity’ type (using the variable: ‘Casualty_Severity’) ▪ When loading the “Casualties0515” sheet, ‘Only Create Connection’ option was chosen since this is the final Power Query to create before loading this and two previously created queries into Power Pivot as a data model
  • 8. CREATE DATA MODEL FROM 3 POWER QUERIES Loading Power Queries into Power Pivot as Data Model The ‘Accidents 0515’, ‘vehicles05151 and ‘causalities0515’ Power Queries were loaded into Power Pivot as a data model Excel Power Pivot To complete the data modelling process, at the Diagram View module in the Power Pivot workspace, the four tables were linked, using the:  ‘Accident_index’ key for the ‘Accidents 0515’, ‘vehicles0515’ and ‘causalities0515’ tables,  ‘Vehicle_Type’ key for the ‘vehicles0515’ and ‘Vehicle_Description’ tables (the “F1” key in the ‘Vehicle_Description’ table is the ‘Vehicle_Type’ key)
  • 9. CREATING DATA WAREHOUSE USING POWER QUERY & POWER PIVOT DATA WAREHOUSE OF MEANINGFUL INFORMATION ON ROAD ACCIDENTS Author: Anthony Mok Date: 18 Nov 2023 Email: xxiaohao@yahoo.com