Sei sulla pagina 1di 26

Module 4

Importing Data from Databases


Module Overview

• Available Data Sources


• Previewing, Shaping, and Transforming Data
• Loading Data
• Table Relationships and Hierarchies
Lesson 1: Available Data Sources

• Databases
• Azure
• Other Sources
Databases

• Microsoft Access
• Microsoft SQL Server
• Microsoft SQL Server Analysis Services
• Oracle RDBMS
• IBM DB2
• MySQL
Azure

Azure

VMs SQL Marketplace Blobs Tables


Database
Other Sources

• Websites and web services


• SharePoint lists
• OData feeds
• Active Directory
• Microsoft Exchange
Lesson 2: Previewing, Shaping, and Transforming
Data

• Previewing Database Data


• Editing Queries
• Transforming Data
• Demonstration: Formulating a Query
Previewing Database Data

1. Connect to a database
2. Browse through databases, tables, and views
3. Select one or more tables or views
Editing Queries

• The Query Settings Pane


• Column and row operations
Transforming Data

• Common Operations
• Transpose, reverse order, count rows, move, list, pivot,
fill
• Text Operations
• Split columns, merge columns, format, parse

• Numeric Operations
• Averages, standard deviations, trigonometric functions

• Date Operations
• Day of the week, year, time, duration
Demonstration: Formulating a Query

In this demonstration, you will see how to:


• Connect to a SQL Express database for an Excel
query
• Format and transform data in a query
• Load data into an Excel table
Lesson 3: Loading Data

• Loading Data from the Query Editor


• Using Multiple Data Sources
• Loading Data from an Excel Table
• Date Tables
• Demonstration: Adding a Date Table
Loading Data from the Query Editor

1. Send your query to the data source


2. Retrieve results
3. Apply data transformation operations
4. Loads the transformed results
Using Multiple Data Sources

• Queries from multiple


data sources
Loading Data from an Excel Table

• Adding an internal Excel table to the Data Model:


1. Select the Excel table in the current workbook
2. On the Power Pivot tab, click Add to Data Model
Date Tables

• Problems with date columns in analysis


• Adding a date table
Demonstration: Adding a Date Table

In this demonstration, you will see how to:


• Add an Excel table to the Data Model
• Add a date table to the Data Model
Lesson 4: Table Relationships and Hierarchies

• Relationships and Queries


• Creating Relationships
• Hierarchies
• Demonstration: Creating Relationships and
Hierarchies
Relationships and Queries

Products ProductCategories
Name Product Price Category Category Name
Number ID ID
1 Bikes
A300 5621 154.34 1
2 Helmets
A350 5622 250.00 1
3 Tires
B250 5623 610.00 1
4 Panniers
CarryAll1 5624 56.99 4

CarryAll2 5625 65.99 4


Creating Relationships

• Manually creating a relationship


• Using the Manage Relationships dialog
• Using the Diagram view

• Handling relationships between more than one


column
• Merge the columns and use the new columns for the
relationship
Hierarchies

• Hierarchies define multiple levels • Canada


in a single value • Mexico
• Hierarchies enable drill-down • USA
from large objects to smaller • MA
objects • NY
• Create hierarchies by using the • Albany
Diagram View in the Data Model • Buffalo
Manager • New York
• Syracuse
• WA
Demonstration: Creating Relationships and
Hierarchies

In this demonstration, you will see how to:


• Add a hierarchy to an existing Data Model
• Use a hierarchy to create a navigable PivotTable
Lab: Importing Data from Multiple Sources

• Exercise 1: Import Data from SQL Server


• Exercise 2: Import Data from CSV Files
• Exercise 3: Create a Date Table and Manage
Relationships

Logon Information
Virtual machine: 20779B-MIA-CLI
User name: Student
Password: Pa55w.rd

Estimated Time: 60 minutes


Lab Scenario

You have sales data in a SQL Server database. You


want to import this data into the Excel Data Model
and use it as the basis of a PivotTable and
PivotChart analysis. Sales staff have recorded
discount information in text files. You want to add
this information to the Data Model to enrich your
analysis.
Lab Review

• When you connected to the CSV data files, why


did the Query Editor identify all columns as text
columns?
• The Calendar date table that you add in Exercise 2
includes a hierarchy based on the Year, Month,
and Day columns. Are there any other columns
that could be used to construct a hierarchy in the
Data Model?
Module Review and Takeaways

• Review Question(s)

Potrebbero piacerti anche