0% found this document useful (0 votes)
22 views56 pages

Module 2

Module 2 covers data extraction in Power BI, detailing various data sources including files, databases, and SaaS connectors. It explains how to use Power Query for data transformation and the functionalities of Power BI Desktop's Report, Data, and Model views. The module also discusses using Python and R scripts for data processing and the importance of query parameters for dynamic reporting.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views56 pages

Module 2

Module 2 covers data extraction in Power BI, detailing various data sources including files, databases, and SaaS connectors. It explains how to use Power Query for data transformation and the functionalities of Power BI Desktop's Report, Data, and Model views. The module also discusses using Python and R scripts for data processing and the importance of query parameters for dynamic reporting.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Module 2 – Data

Extraction

Copyright Intellipaat. All rights reserved.


Agenda

Overview of Data Sources in


01 Power BI Desktop
02 Power BI

Using Files as a Updating Files in


03 Data Source
04 Power BI

Using a Database as a Using SaaS


05 Data Source 06 Connectors

Copyright Intellipaat. All rights reserved.


Agenda

07 Other Data sources 08 Python Script

09 R Script 10 Power Query and editor

Areas in Power
1 12 Advanced Editor
Query Editor
1

Copyright Intellipaat. All rights reserved.


Overview of Power BI
Desktop

Copyright Intellipaat. All rights reserved.


Overview of Power BI Desktop

Power BI Desktop features a workspace for creating reports and


comprises three key views in which we can work

Report View Data View Model View

Copyright Intellipaat. All rights reserved.


Overview of Power BI Desktop

This is the main workspace where we add report items, such as


bar charts, maps, and pie charts, and display data using these
report items
Report View
Data View

Model View

Copyright Intellipaat. All rights reserved.


Overview of Power BI Desktop
Report View

Copyright Intellipaat. All rights reserved.


Overview of Power BI Desktop

The data view is used to see imported datasets, in addition to


shaping the data using transformations and M expressions
Report View
Data View

Model View

Copyright Intellipaat. All rights reserved.


Overview of Power BI Desktop
Data View

Copyright Intellipaat. All rights reserved.


Overview of Power BI Desktop

Power BI has an autodetect relationships feature, and we can


also create relationships manually and set relationship properties

Report View
Data View

Model View

Copyright Intellipaat. All rights reserved.


Overview of Power BI Desktop
Model View

Copyright Intellipaat. All rights reserved.


Data Sources in Power BI

Copyright Intellipaat. All rights reserved.


Data Sources in Power BI

In Power BI Desktop, we have a wide choice of sources to import


data
from, including database, file, Azure, and SaaS connectors

Database Connectors File Connectors Azure Connectors SaaS Connectors

Copyright Intellipaat. All rights reserved.


Data Sources in Power BI

Power BI supports the database connections for importing


Data Sources data from on-premises sources

Database Database connectors include:


Connectors

File Connectors
MySQL

Azure Connectors SQL Server IBM Db2

SaaS Connectors
Oracle Teradata

Copyright Intellipaat. All rights reserved.


Data Sources in Power BI

Using a file connector, we can import either a single file or a


folder to select multiple files. This is useful when we have a
Data Sources
folder location used to store files created on a schedule

Database
Connectors File connectors include:

File Connectors
CSV

Azure Connectors MS Excel Text

SaaS Connectors
XML JSON

Copyright Intellipaat. All rights reserved.


Data Sources in Power BI

Using Azure connectors in Power BI, we can connect to the


database in the Azure cloud
Data Sources

Database
Connectors Azure connectors include:

File Connectors
Azure SQL Data Warehouse

Azure
AzureTable
Connectors Azure Blob Storage Storage
SaaS Connectors
Azure SQL Database

Copyright Intellipaat. All rights reserved.


Data Sources in Power BI

Power BI Desktop makes it easy to connect to external


SaaS applications for analyzing data related to fields
Data Sources
such as sales, marketing, finance, and social media

Database
Connectors SaaS connectors include:

File Connectors
Salesforce

Azure Connectors Google Analytics GitHub

SaaS
Connectors Facebook QuickBooks Online

Copyright Intellipaat. All rights reserved.


Using Excel as a Data
Source

Copyright Intellipaat. All rights reserved.


Using Excel as a Data
Source
In Power BI, we can connect to files from Power BI Desktop or from Power BI
Service

Using Power BI, we can also connect to various file formats, folders, etc.
and even import Power BI Report files with the .pbix extension

When we import data directly into Power BI Service, the maximum


file size should be 250 MB

Copyright Intellipaat. All rights reserved.


Using Excel as a Data Source

There are two approaches in extracting an Excel file as a Data


Source:

Connect to an Excel workbook and use its contents as a dataset for Power BI reports and dashboards.
We can edit our data using Power Query Editor

Connect the contents of Excel


to Power BI Desktop

Import a whole Excel workbook and explore it in the same way we would do when using
Excel Online, but here we cannot edit our data

Connect the whole Excel


workbook to Power BI Desktop

Copyright Intellipaat. All rights reserved.


Using Excel as a Data
Source

1 Click on Get Data

2 Different data sources appears

3 Click on Files

Select the file format of our


4
choice

Copyright Intellipaat. All rights reserved.


Demo: Importing Data from Excel

Copyright Intellipaat. All rights reserved.


Updating Files in Power BI

Copyright Intellipaat. All rights reserved.


Updating Files in Power BI

Uploading a File Data Refresh

Data Refresh in Power BI works based on the


This applies to CSV, Power BI Desktop files, and Excel
subscription types and on the data sources

We upload a local file to Power BI to build reports • For free users, data can be refreshed daily
and dashboards; then, we make changes to the file with a maximum of 10,000 rows/hour
and upload it again, providing the file name as the • For pro users, data can be refreshed hourly
same, and then Power BI will update the file upto 1 million rows/hour

Copyright Intellipaat. All rights reserved.


Using a Database as a
Data Source

Copyright Intellipaat. All rights reserved.


Using a Database as a Data Source

Microsoft SQL Server is one of the database sources available in Power BI, which is a popular
relational
database management system (RDBMS)

It can handle multiple user connections and a high volume of data


transactions, and it can run both in the cloud and
on-premises

The steps for connecting SQL Server to Power BI is the same as


connecting other databases such as Oracle, MySQL, or IBM Db2

Copyright Intellipaat. All rights reserved.


Using a Database as a Data Source

Power BI Desktop
1 --> Get Data

Click on SQL
Server Database 2

Enter the server name


3 and the database
name

Use a query or select


tables and views 4

Load into Power Query


5 Editor or directly into a
data model
Copyright Intellipaat. All rights reserved.
Demo: Importing Data from
SQL Server

Copyright Intellipaat. All rights reserved.


Using SaaS Connectors

Copyright Intellipaat. All rights reserved.


Using SaaS Connectors

From Power BI Desktop, we can import data from third-party online


solutions and combine the data in reports and dashboards

For example, we can create a report from Facebook that shows marketing data combined
with the sales data that is from Salesforce

Copyright Intellipaat. All rights reserved.


Other Data Sources

Copyright Intellipaat. All rights reserved.


Other Data Sources

R Script
Web Python Script
Connector

OData Feed SharePoint

Copyright Intellipaat. All rights reserved.


Python Script

Copyright Intellipaat. All rights reserved.


Python Script

We can directly run Python scripts in Power BI Desktop by importing the datasets
into the Power BI data model and adding visualizations to them

To run Python scripts in Power BI Desktop, install


1 Python and the required Python packages

2 In Power BI Desktop, enable Python scripting

Run our Python script and import data


3 from Power BI Desktop
Get data > Others > Python Script

Click on Connect; copy the Python script to the


4 Python script dialog box, and click on OK

Copyright Intellipaat. All rights reserved.


Python Script

Python can also be used for data cleansing, performing advanced data
shaping, analytics, etc. in Power BI Query Editor

Python in Query Editor

We can also use an external Python IDE to create Python scripts and
use those scripts in Power BI Desktop

Python IDE

We can also create Python visuals in Power BI Desktop

Python Visuals

Copyright Intellipaat. All rights reserved.


R Script

Copyright Intellipaat. All rights reserved.


R Script

The R programming language has been integrated with the Transact-SQL language that helps
Data Scientists develop applications in R and deploy them in a SQL Server production
environment

To integrate R and SQL, a service was introduced


known as SQL Server R Services

This service helps us run R scripts, create data


models, and import results to Power BI Desktop

Copyright Intellipaat. All rights reserved.


Power Query

Copyright Intellipaat. All rights reserved.


Power Query

Power Query is an engine for data transformation and preparation.

Highly interactive for rapidly and iteratively creating


q 01
ue queries over any data source, of any size

Power Query has a graphical interface for obtaining


02
02 . data from data sources as well as a Power Query Editor
f or performing transformations

03 Extraction and transformation of data can be


03 performed using power query
Query
04 settings

05 Status Bar

Copyright Intellipaat. All rights reserved.


Query Parameters

Copyright Intellipaat. All rights reserved.


Query Parameters

Users can simply make sections of reports and data models dependent on
one or more parameter values using query parameters.

By including Query Parameters in a report, the user can


01 make the report's elements rely on the parameters
they've created.
02 .
Parameters allow you to change the output of the queries
02 dynamically depending on their value.

Model authors can use Dynamic M Query Parameters to


allow report viewers to set the value(s) for a M Query
03
Parameter using filters or slicers, which can be extremely
handy for query performance optimizations

Copyright Intellipaat. All rights reserved.


Power Query M

Copyright Intellipaat. All rights reserved.


Power Query M

Power query is all about connecting to several data sources and "mashing" them,
the M stands for data mash-up. M is a functional language, which means it is mostly
comprised up of functions that are invoked to evaluate and give results. Power Query M
function has over 700 functions. Some of the functions are listed below.

Functions by Category Uses Example


List functions 02 Queries Pane List.Count, List.Distinct,
Create and manipulate list values
List.Combine, List.Sum
Table functions 03 Create andCurrent
manipulate
viewtable values ItemExpression.From,
Table.ToList, Table.Column
DateTime functions Create and manipulate table values DateTime.Date, DateTime.From,
Query
04 settings DateTime.FromText
Logical functions Create and manipulate logical values Logical.From, Logical.From text

Status Bar

Copyright Intellipaat. All rights reserved.


Power Query Editor

Copyright Intellipaat. All rights reserved.


Power Query Editor

Power Query Editor helps us load data from a wide number of data
sources and apply transformations on it

Load
Transform Data
Data

Shape
Merge Data
Data

Format
Data

Copyright Intellipaat. All rights reserved.


Components of Power
Query Editor

Copyright Intellipaat. All rights reserved.


Components of Power Query Editor

Ribbon

01 Ribbon
The ribbon in Power Query Editor has six tabs:
• Home
02 Queries Pane • Transform
• Add Column
• View
03 Current view • Tools
• Help
04 Query Settings

05 Status Bar

Copyright Intellipaat. All rights reserved.


Components of Power Query Editor

Five components of Power Query editor are -

01 Ribbon

02 Queries Pane

03 Current view

Query
04 settings

05 Status Bar

Copyright Intellipaat. All rights reserved.


Components of Power Query Editor

Queries Pane

01 Ribbon The Queries pane will show the active queries and their names.
When we select a query from this pane, data will be displayed
on the current view pane
02 Queries Pane

03 Current view

04 Query Settings

05 Status Bar

Copyright Intellipaat. All rights reserved.


Components of Power Query Editor

Current view

In this pane, the data from the selected query is displayed where
01 Ribbon
we can shape, transform, or merge the data to meet our needs

02 Queries Pane

03 Current view

04 Query Settings

05 Status Bar

Copyright Intellipaat. All rights reserved.


Components of Power Query Editor

Query Settings

This pane shows the steps associated with a query. All the
01 Ribbon operations that we perform on the data are captured by
APPLIED STEPS in the Query Settings pane
02 Queries Pane

03 Current view

04 Query Settings

05 Status Bar

Copyright Intellipaat. All rights reserved.


Components of Power Query Editor

Status Bar

01 Ribbon A bar that shows important details about the query, including as
Ribbon
execution time, total columns and rows, and processing status.
This bar also has buttons that allow you to change your current
02 Queries Pane view.

03 Current view

04 Query Settings

05 Status Bar

Copyright Intellipaat. All rights reserved.


Advanced Editor

Copyright Intellipaat. All rights reserved.


Advanced Editor

Using Advanced Editor, we can see the code that Power Query Editor
uses with each step, and we can also create our own code

To launch Advanced Editor, go to View > Advanced Editor

Copyright Intellipaat. All rights reserved.


Demo: Overview of Query
Editor

Copyright Intellipaat. All rights reserved.


India: +91-7847955955

US: 1-800-216-8930 (TOLL FREE)

[email protected]

24/7 Chat with Our Course


Advisor

Copyright Intellipaat. All rights reserved.

You might also like