University of Mumbai: Teacher's Reference Manual
University of Mumbai: Teacher's Reference Manual
Note: This Manual is just a reference manual for conducting the practical in laboratory.
The respective tutors / teachers are supposed to conduct the practical with necessary
modifications.
Practical 1: Import the legacy data from different sources such as (Excel,
SqlServer, Oracle etc.) and load in the target system.
2) From the Home ribbon, select Get Data. Excel is one of the Most Common data
connections, so you can select it directly from the Get Data menu.
3) If you select the Get Data button directly, you can also select FIle > Excel and select
Connect.
5) In the Navigator pane, select the Products table and then select Edit.
2
Business Intelligence LAB Manual
3) In the OData Feed dialog box, paste the URL for the Northwind OData feed.
4) Select OK.
5) In the Navigator pane, select the Orders table, and then select Edit.
3
Business Intelligence LAB Manual
Note - You can click a table name, without selecting the checkbox, to see a preview.
The data extraction is first step of ETL. There are 2 Types of Data Extraction
1. Full Extraction : All the data from source systems or operational systems gets extracted to
staging area. (Initial Load)
2. Partial Extraction : Sometimes we get notification from the source system to update
specific date. It is called as Delta load.
Source System Performance: The Extraction strategies should not affect source system
performance.
The data transformation is second step.After extracting the data there is big need to do the
transformation as per the target system.I would like to give you some bullet points of Data
Transformation.
4
Business Intelligence LAB Manual
• There are following important steps of Data Transformation :
• Data loading phase loads the prepared data from staging tables to main tables.
Step 1 − Open either BIDS\SSDT based on the version from the Microsoft SQL Server
programs group. The following screen appears.
Step 2 − The above screen shows SSDT has opened. Go to file at the top left corner in the
above image and click New. Select project and the following screen opens.
5
Business Intelligence LAB Manual
Step 3 − Select Integration Services under Business Intelligence on the top left corner in the
above screen to get the following screen.
Step 4 − In the above screen, select either Integration Services Project or Integration Services
Import Project Wizard based on your requirement to develop\create the package.
Modes
There are two modes − Native Mode (SQL Server Mode) and Share Point Mode.
Models
There are two models − Tabular Model (For Team and Personal Analysis) and Multi
Dimensions Model (For Corporate Analysis).
6
Business Intelligence LAB Manual
The BIDS (Business Intelligence Studio till 2008 R2) and SSDT (SQL Server Data Tools
from 2012) are environments to work with SSAS.
Step 1 − Open either BIDS\SSDT based on the version from the Microsoft SQL Server
programs group. The following screen will appear.
Step 2 − The above screen shows SSDT has opened. Go to file on the top left corner in the
above image and click New. Select project and the following screen opens.
Step 3 − Select Analysis Services in the above screen under Business Intelligence as seen on
the top left corner. The following screen pops up.
7
Business Intelligence LAB Manual
Step 4 − In the above screen, select any one option from the listed five options based on your
requirement to work with Analysis services.
In this step you remove all columns except ProductID, ProductName, UnitsInStock, and
QuantityPerUnit
Power BI Desktop includes Query Editor, which is where you shape and transform your data
connections. Query Editor opens automatically when you select Edit from Navigator. You can
also open the Query Editor by selecting Edit Queries from the Home ribbon in Power BI
Desktop. The following steps are performed in Query Editor.
1. In Query Editor, select the ProductID, ProductName, QuantityPerUnit, and
UnitsInStock columns (use Ctrl+Click to select more than one column, or
Shift+Click to select columns that are beside each other).
2. Select Remove Columns > Remove Other Columns from the ribbon, or right-click
on a column header and click Remove Other Columns.
8
Business Intelligence LAB Manual
When Query Editor connects to data, it reviews each field and to determine the best data type.
For the Excel workbook, products in stock will always be a whole number, so in this step you
confirm the UnitsInStock column’s datatype is Whole Number.
1. Select the UnitsInStock column.
2. Select the Data Type drop-down button in the Home ribbon.
3. If not already a Whole Number, select Whole Number for data type from the drop down
(the Data Type: button also displays the data type for the current selection).
9
Business Intelligence LAB Manual
In this step, you expand the Order_Details table that is related to the Orders table, to combine
the ProductID, UnitPrice, and Quantity columns from Order_Details into the Orders table.
This is a representation of the data in these tables:
The Expand operation combines columns from a related table into a subject table. When the
query runs, rows from the related table (Order_Details) are combined into rows from the
subject table (Orders).
After you expand the Order_Details table, three new columns and additional rows are added
to the Orders table, one for each row in the nested or related table.
1. In the Query View, scroll to the Order_Details column.
2. In the Order_Details column, select the expand icon ( ).
3. In the Expand drop-down:
a. Select (Select All Columns) to clear all columns.
b. Select ProductID, UnitPrice, and Quantity.
c. Click OK.
10
Business Intelligence LAB Manual
2. In the Add Custom Column dialog box, in the Custom Column Formula textbox, enter
[Order_Details.UnitPrice] * [Order_Details.Quantity].
3. In the New column name textbox, enter LineTotal.
4. Click OK.
11
Business Intelligence LAB Manual
12
Business Intelligence LAB Manual
2. Power BI Desktop loads the data from the two queries.
3. Once the data is loaded, select the Manage Relationships button Home ribbon.
5.When we attempt to create the relationship, we see that one already exists! As shown in the
Create Relationship dialog (by the shaded columns), the ProductsID fields in each query
already have an established relationship.
13
Business Intelligence LAB Manual
6. We see the following, which visualizes the relationship between the queries.
14
Business Intelligence LAB Manual
7. When you double-click the arrow on the line that connects the to queries, an Edit
Relationship dialog appears.
8. No need to make any changes, so we'll just select Cancel to close the Edit
Relationship dialog.
Power BI Desktop lets you create a variety of visualizations to gain insights from your data.
You can build reports with multiple pages and each page can have multiple visuals. You can
interact with your visualizations to help analyze and understand your data
In this task, you create a report based on the data previously loaded. You use the Fields pane
to select the columns from which you create the visualizations.
Step 1: Create charts showing Units in Stock by Product and Total Sales by Year
15
Business Intelligence LAB Manual
1. Drag UnitsInStock from the Field pane (the Fields pane is along the right of the
screen) onto a blank space on the canvas. A Table visualization is created. Next, drag
ProductName to the Axis box, found in the bottom half of the Visualizations pane.
Then we then select Sort By > UnitsInStock using the skittles in the top right corer of
the visualization.
2. Drag OrderDate to the canvas beneath the first chart, then drag LineTotal (again, from
the Fields pane) onto the visual, then select Line Chart. The following visualization is
created.
16
Business Intelligence LAB Manual
3. Next, drag ShipCountry to a space on the canvas in the top right. Because you selected
a geographic field, a map was created automatically. Now drag LineTotal to the Values
field; the circles on the map for each country are now relative in size to the LineTotal
for orders shipped to that country.
17
Business Intelligence LAB Manual
Let us execute our T-SQL Script to create data warehouse with fact tables, dimensions and
populate them with appropriate test values.
Download T-SQL script attached with this article for creation of Sales Data Warehouse or
download from this article “Create First Data Warehouse” and run it in your SQL Server.
Follow the given steps to run the query in SSMS (SQL Server Management Studio).
For creation of OLAP Cube in Microsoft BIDS Environment, follow the 10 easy steps given
below.
Click on Start Menu -> Microsoft SQL Server 2008 R2 -> Click SQL Server Business
Intelligence Development Studio.
18
Business Intelligence LAB Manual
Click File -> New -> Project ->Business Intelligence Projects ->select Analysis Services
Project-> Assign Project Name -> Click OK
3.1 In Solution Explorer, Right click on Data Source -> Click New Data Source
3.1 In Solution Explorer, Right click on Data Source -> Click New Data Source
19
Business Intelligence LAB Manual
3.2 Click on Next
1. Specify Your SQL Server Name where your Data Warehouse was created
2. Select Radio Button according to your SQL Server Authentication mode
3. Specify your Credentials using which you can connect to your SQL Server
4. Select database Sales_DW.
5. Click on Test Connection and verify for its success
6. Click OK.
20
Business Intelligence LAB Manual
21
Business Intelligence LAB Manual
3.7 Assign Data Source Name -> Click Finish
4.1 In the Solution Explorer, Right Click on Data Source View -> Click on New Data
Source View
22
Business Intelligence LAB Manual
4.3 Select Relational Data Source we have created previously (Sales_DW)-> Click Next
4.4 First move your Fact Table to the right side to include in object list.
23
Business Intelligence LAB Manual
Select FactProductSales Table -> Click on Arrow Button to move the selected object to Right
Pane.
4.5 Now to add dimensions which are related to your Fact Table, follow the given steps:
Select Fact Table in Right Pane (Fact product Sales) -> Click On Add Related Tables
4.6 It will add all associated dimensions to your Fact table as per relationship specified in
your SQL DW (Sales_DW).
Click Next.
24
Business Intelligence LAB Manual
5.1 In Solution Explorer -> Right Click on Cube-> Click New Cube
25
Business Intelligence LAB Manual
5.2 Click Next
5.4 Select Fact Table Name from Measure Group Tables (FactProductSales) -> Click
Next
5.5 Choose Measures from the List which you want to place in your Cube --> Click Next
26
Business Intelligence LAB Manual
5.6 Select All Dimensions here which are associated with your Fact Table-> Click Next
5.8 Now your Cube is ready, you can see the newly created cube and dimensions added in
your solution explorer.
27
Business Intelligence LAB Manual
Double click On Dim Date dimension -> Drag and Drop Fields from Table shown in Data
Source View to Attributes-> Drag and Drop attributes from leftmost pane of attributes to
middle pane of Hierarchy.
Drag fields in sequence from Attributes to Hierarchy window (Year, Quarter Name, Month
Name, Week of the Month, Full Date UK),
28
Business Intelligence LAB Manual
8.1 In Solution Explorer, right click on Project Name (SalesDataAnalysis) -- > Click
Properties
29
Business Intelligence LAB Manual
In Configuration Properties, Select Deployment-> Assign Your SQL Server Instance Name
Where Analysis Services Is Installed (mubin-pc\fairy) (Machine Name\Instance Name) ->
Choose Deployment Mode Deploy All as of now ->Select Processing Option Do Not
Process -> Click OK
8.3 In Solution Explorer, right click on Project Name (SalesDataAnalysis) -- > Click Deploy
8.4 Once Deployment will finish, you can see the message Deployment Completed in
deployment Properties.
30
Business Intelligence LAB Manual
9.1 In Solution Explorer, right click on Project Name (SalesDataAnalysis) -- > Click Process
31
Business Intelligence LAB Manual
9.3 Once processing is complete, you can see Status as Process Succeeded -->Click Close to
close both the open windows for processing one after the other.
10.1 In Solution Explorer, right click on Cube Name (SalesDataAnalysisCube) -- > Click
Browse
32
Business Intelligence LAB Manual
10.2 Drag and drop measures in to Detail fields, & Drag and Drop Dimension Attributes in
Row Field or Column fields.
33
Business Intelligence LAB Manual
Practical 5: Apply the what – if Analysis for data visualization. Design and generate
necessary reports based on the data warehouse data.
A book store and have 100 books in storage. You sell a certain % for the highest price of $50
and a certain % for the lower price of $20.
If you sell 60% for the highest price, cell D10 calculates a total profit of 60 * $50 + 40 * $20
= $3800.
Create Different Scenarios
But what if you sell 70% for the highest price? And what if you sell 80% for the highest price?
Or 90%, or even 100%? Each different percentage is a different scenario. You can use the
Scenario Manager to create these scenarios.
Note: You can simply type in a different percentage into cell C4 to see the corresponding result
of a scenario in cell D10. However, what-if analysis enables you to easily compare the results
of different scenarios. Read on.
1. On the Data tab, in the Forecast group, click What-If Analysis.
34
Business Intelligence LAB Manual
The Scenario Manager dialog box appears.
3. Add a scenario by clicking on Add.
4. Type a name (60% highest), select cell C4 (% sold for the highest price) for the
Changing cells and click on OK.
35
Business Intelligence LAB Manual
36
Business Intelligence LAB Manual
Consider the annual rainfall details at a place starting from January 2012. We create an R time series
object for a period of 12 months and plot it.
Output:
When we execute the above code, it produces the following result and chart −
37
Business Intelligence LAB Manual
38
Business Intelligence LAB Manual
Practical 7: Practical Implementation of Decision Tree using R Tool
install.packages("party")
The package "party" has the function ctree() which is used to create and analyze decison tree.
Syntax
ctree(formula, data)
Input Data
We will use the R in-built data set named readingSkills to create a decision tree. It describes
the score of someone's readingSkills if we know the variables "age","shoesize","score" and
whether the person is a native speaker or not.
When we execute the above code, it produces the following result and chart −
We will use the ctree() function to create the decision tree and see its graph.
39
Business Intelligence LAB Manual
data = input.dat)
Output:-
null device
1
Loading required package: methods
Loading required package: grid
Loading required package: mvtnorm
Loading required package: modeltools
Loading required package: stats4
Loading required package: strucchange
Loading required package: zoo
as.Date, as.Date.numeric
40
Business Intelligence LAB Manual
Practical 8: k-means clustering using R
41
Business Intelligence LAB Manual
Practical 9: Prediction Using Linear Regression
In Linear Regression these two variables are related through an equation, where exponent (power) of
both these variables is 1. Mathematically a linear relationship represents a straight line when plotted as
a graph. A non-linear relationship where the exponent of any variable is not equal to 1 creates a curve.
y = ax + b is an equation for linear regression.
Where, y is the response variable, x is the predictor variable and a and b are constants which are called
the coefficients.
A simple example of regression is predicting weight of a person when his height is known.
To do this we need to have the relationship between height and weight of a person.
• Carry out the experiment of gathering a sample of observed values of height and
corresponding weight.
• Create a relationship model using the lm() functions in R.
• Find the coefficients from the model created and create the mathematical equation
using these
• Get a summary of the relationship model to know the average error in prediction.
Also called residuals.
• To predict the weight of new persons, use the predict() function in R.
Input Data
# Values of height
151, 174, 138, 186, 128, 136, 179, 163, 152, 131
# Values of weight.
63, 81, 56, 91, 47, 57, 76, 72, 62, 48
lm() Function
This function creates the relationship model between the predictor and the response variable.
Syntax
lm(formula,data)
42
Business Intelligence LAB Manual
x <- c(151, 174, 138, 186, 128, 136, 179, 163, 152, 131)
y <- c(63, 81, 56, 91, 47, 57, 76, 72, 62, 48)
print(relation)
When we execute the above code, it produces the following result –
Call:
lm(formula = y ~ x)
Coefficients:
(Intercept) x
-38.4551 0.6746
print(summary(relation))
When we execute the above code, it produces the following result –
call:
lm(formula = y ~ x)
Residuals:
Min 1Q Median 3Q Max
-6.3002 -1.6629 0.0412 1.8944 3.9775
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -38.45509 8.04901 -4.778 0.00139 **
x 0.67461 0.05191 12.997 1.16e-06 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Syntax
predict(object, newdata)
• object is the formula which is already created using the lm() function.
• newdata is the vector containing the new value for predictor variable.
43
Business Intelligence LAB Manual
Predict the weight of new persons
# The predictor vector.
x <- c(151, 174, 138, 186, 128, 136, 179, 163, 152, 131)
Result:
1
76.22869
44
Business Intelligence LAB Manual
Time series is a series of data points in which each data point is associated with a timestamp.
A simple example is the price of a stock in the stock market at different points of time on a
given day. Another example is the amount of rainfall in a region at different months of the
year. R language uses many functions to create, manipulate and plot the time series data.
The data for the time series is stored in an R object called time-series object. It is also a R
data object like a vector or data frame.
Syntax
• data is a vector or matrix containing the values used in the time series.
• start specifies the start time for the first observation in time series.
• end specifies the end time for the last observation in time series.
• frequency specifies the number of observations per unit time.
Example
Consider the annual rainfall details at a place starting from January 2012. We create an R
time series object for a period of 12 months and plot it.
45
Business Intelligence LAB Manual
Output:-
46
Business Intelligence LAB Manual
Practical 11: Data Modelling and Analytics with Pivot Table in Excel
Data Model is used for building a model where data from various sources can be combined by
creating relationships among the data sources. A Data Model integrates the tables, enabling
extensive analysis using PivotTables, Power Pivot, and Power View.
A Data Model is created automatically when you import two or more tables simultaneously
from a database. The existing database relationships between those tables is used to create the
Data Model in Excel.
Step 3 − In the Get External Data group, click on the option From Access. The Select Data
Source dialog box opens.
(url:/ https://fcschools.instructure.com/courses/373/files/10607)
Step 5 − The Select Table window, displaying all the tables found in the database, appears.
47
Business Intelligence LAB Manual
Step 6 − Tables in a database are similar to the tables in Excel. Check the ‘Enable selection
of multiple tables’ box, and select all the tables. Then click OK.
Step 7 − The Import Data window appears. Select the PivotTable Report option. This option
imports the tables into Excel and prepares a PivotTable for analyzing the imported tables.
Notice that the checkbox at the bottom of the window - ‘Add this data to the Data Model’ is
selected and disabled.
48
Business Intelligence LAB Manual
Step 8 − The data is imported, and a PivotTable is created using the imported tables.
Step 1 − You know how to add fields to PivotTable and drag fields across areas. Even if you
are not sure of the final report that you want, you can play with the data and choose the best-
suited report.
In PivotTable Fields, click on the arrow beside the table - Medals to expand it to show the
fields in that table. Drag the NOC_CountryRegion field in the Medals table to the
COLUMNS area.
Step 2 − Drag Discipline from the Disciplines table to the ROWS area.
49
Business Intelligence LAB Manual
Step 3 − Filter Discipline to display only five sports: Archery, Diving, Fencing, Figure
Skating, and Speed Skating. This can be done either in PivotTable Fields area, or from the
Row Labels filter in the PivotTable itself.
Step 4 − In PivotTable Fields, from the Medals table, drag Medal to the VALUES area.
Step 5 − From the Medals table, select Medal again and drag it into the FILTERS area.
Step 6 − Click the dropdown list button to the right of the Column labels.
The Value Filters dialog box for the count of Medals is greater than appears.
50
Business Intelligence LAB Manual
Step 9 − Type 80 in the Right Field.
The PivotTable displays only those regions, which has more than total 80 medals.
Relationships let you analyze your collections of the data in Excel, and create interesting and
aesthetic reports from the data you import.
Step 2 − Create a new table with new data. Name the new table as Sports.
51
Business Intelligence LAB Manual
Step 3 − Now you can create relationship between this new table and the other tables that
already exist in the Data Model in Excel. Rename the Sheet1 as Medals and Sheet2 as
Sports.
On the Medals sheet, in the PivotTable Fields List, click All. A complete list of available
tables will be displayed. The newly added table - Sports will also be displayed.
Step 4 − Click on Sports. In the expanded list of fields, select Sports. Excel messages you to
create a relationship between tables.
52
Business Intelligence LAB Manual
Step 6 − To create the relationship, one of the tables must have a column of unique, non-
repeated, values. In the Disciplines table, SportID column has such values. The table Sports
that we have created also has the SportID column. In Table, select Disciplines.
Step 9 − In Related Column (Primary), SportID gets selected automatically. Click OK.
Step 10 − The PivotTable is modified to reflect the addition of the new Data Field Sport.
Adjust the order of the fields in the Rows area to maintain the Hierarchy. In this case, Sport
53
Business Intelligence LAB Manual
should be first and Discipline should be the next, as Discipline will be nested in Sport as a
sub-category.
54
Business Intelligence LAB Manual
Practical 12: Data Analysis and Visualization using Advanced Excel
Power View is a feature of Microsoft Excel 2013 that enables interactive data exploration,
visualization, and presentation encouraging intuitive ad-hoc reporting.
Step 3 − In the Manage box, click the drop-down arrow and select Excel Add-ins.
Step 4 − All the available Add-ins will be displayed. If Power View Add-in is enabled, it
appears in Active Application Add-ins.
55
Business Intelligence LAB Manual
Step 2 − In the Manage box, click the drop-down arrow and select COM Add-ins
56
Business Intelligence LAB Manual
Step 2 − Click on Insert tab.
An Opening Power View window opens, showing the progress of Working on opening Power View
sheet.
The Power View sheet is created for you and added to your Workbook with the Power
View. On the Right-side of the Power View, you find the Power View Fields. Under the
Power View Fields you will find Areas.
In the Ribbon, if you click on Design tab, you will find various Visualization options.
57
Business Intelligence LAB Manual
For every visualization you want to create, you start on a Power View sheet by creating a
table, which you then easily convert to other visualizations, to find one that best illustrates
your Data.
Step 1 − Under the Power View Fields, select the fields you want to visualize.
Step 2 − By default, the Table View will be displayed. As you move across the Table, on the
top-right corner, you find two symbols – Filters and Pop out.
Step 3 − Click on the Filters symbol. The filters will be displayed on the right side. Filters
has two tabs. View tab to filter all visualizations in this View and Table tab to filter the
specific values in this table only.
58
Business Intelligence LAB Manual
Visualization – Matrix
A Matrix is made up of rows and columns like a Table. However, a Matrix has the following
capabilities that a Table does not have −
59
Business Intelligence LAB Manual
Visualization – Card
You can convert a Table to a series of Cards that display the data from each row in the table
laid out in a Card format, like an index Card.
60
Business Intelligence LAB Manual
Visualization – Charts
In Power View, you have a number of Chart options: Pie, Column, Bar, Line, Scatter, and
Bubble. You can use several design options in a chart such as showing and hiding labels,
legends, and titles.
You can use Line, Bar and Column Charts for comparing data points in one or more data
series. In these Charts, the x-axis displays one field and the y-axis displays another, making it
easy to see the relationship between the two values for all the items in the Chart.
Line Charts distribute category data evenly along a horizontal (category) axis, and all
numerical value data along a vertical (value) axis.
Step 2 − Create a Table Visualization for two Columns, NOC_CountryRegion and Count
of Medal.
61
Business Intelligence LAB Manual
62
Business Intelligence LAB Manual
In a Bar Chart, categories are organized along the vertical axis and values along the
horizontal axis. In Power View, there are three subtypes of the Bar Chart: Stacked, 100%
stacked, and Clustered.
The Line Chart Visualization converts into Stacked Bar Chart Visualization.
63
Business Intelligence LAB Manual
Step 10 − In the Power View Fields, in the Medals Table, select the Field Gender also.
Step 11 − Click on one of the bars. That portion of the bar is highlighted. Only the row containing the
Data specific to the selected bar is displayed in the table above.
64
Business Intelligence LAB Manual
You can use the column charts for showing data changes over a period of time or for
illustrating comparison among different items. In a Column Chart, the categories are along
the horizontal axis and values are along the vertical axis.
In Power View, there are three Column Chart subtypes: Stacked, 100% stacked, and
Clustered.
The Stacked Bar Chart Visualization converts into Stacked Column Chart Visualization.
65
Business Intelligence LAB Manual
66