0% found this document useful (0 votes)
2 views98 pages

Power Bi Lab Manual

The document is a lab manual for Business Intelligence using Power BI at St. Ann's College of Engineering & Technology, detailing a series of experiments for students from the 2022-2026 batch. It covers various exercises including data import from different sources, ETL processes, data visualization, and creating dashboards and cubes in SQL Server and Power BI. The manual provides step-by-step instructions for each exercise to facilitate hands-on learning in data science and business intelligence.

Uploaded by

vishnusaketh1304
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views98 pages

Power Bi Lab Manual

The document is a lab manual for Business Intelligence using Power BI at St. Ann's College of Engineering & Technology, detailing a series of experiments for students from the 2022-2026 batch. It covers various exercises including data import from different sources, ETL processes, data visualization, and creating dashboards and cubes in SQL Server and Power BI. The manual provides step-by-step instructions for each exercise to facilitate hands-on learning in data science and business intelligence.

Uploaded by

vishnusaketh1304
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 98

St.

Ann's College of Engineering & Technology, Chirala

(AUTONOMOUS)

DEPARTMENT OF CSE-DATA SCIENCE

Lab Manual Name: Business Intelligence Using Power Bi

R22 Regulation

Batch: 2022-2026

Academic Year:2024-2025
List of Experiments:
Exercise 1: Import the legacy data from different data sources such as
(Excel, SqlServer, Oracle etc.) and load in the target system.
Exercise 2: Perform the Extraction Transformation and Loading
(ETL) process to construct the database in the Sql
server / Power BI.
Exercise 3: Data Visualization from ETL Process
Exercise 4: Creating a Cube in SQL server 2012
Exercise 5: Apply the what – if Analysis for data visualization. Design
and generate necessary reports based on the data
warehouse data.
Exercise 6: Using the Data Modeling and Navigation
Exercise 7: Creating the Dash Boards
Exercise 8: Develop power BI application with various operations in
Dashboard designer
Exercise 9: Develop a power BI application with Geographical Maps
Exercise 10: Using the Power BI to create geocoding on maps and
visualize spatial distributions.
Exercise 11: Create an interactive exploration of maps using Power BI
Exercise 12: Develop power BI application with MongoDB.

2
Experiment -1

Import the legacy data from different sources such as


(Excel, SqlServer, Oracle etc.) and load in the target system.

Importing Excel Data


1) Launch Power BI Desktop.

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.

4) In the Open File dialog box, select the Products.xlsx file.

5) In the Navigator pane, select the Products table and then select Edit.

3
Importing Data from OData Feed
In this task, you'll bring in order data. This step represents connecting to a sales system. You
import data into Power BI Desktop from the sample Northwind OData feed at the following
URL, which you can copy (and then paste) in the steps below:
http://services.odata.org/V3/Northwind/Northwind.svc/
Connect to an OData feed:
1) From the Home ribbon tab in Query Editor, select Get Data.

2) Browse to the OData Feed data source.

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.

4
Note - You can click a table name, without selecting the checkbox, to see a preview.

5
Exercise -2
Aim : Perform the Extraction Transformation and Loading
(ETL) process to construct the database in the Sqlserver /
Power BI.
Source code:
Step 1 : Data Extraction :

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.

Step 2 : Data Transformation :

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.

 Data Extracted from source system is in to Raw format. We need to transform


it before loading in to target server.
 Data has to be cleaned, mapped and transformed.
There are following important steps of Data Transformation :

1. Selection : Select data to load in target

2. Matching : Match the data with target system

3. Data Transforming : We need to change data as per target table structures

Real life examples of Data Transformation :

 Standardizing data : Data is fetched from multiple sources so it needs to be


standardized as per the target system.
 Character set conversion : Need to transform the character sets as per the target
systems. (Firstname and last name example)
 Calculated and derived values: In source system there is first val and second val and
in target we need the calculation of first val and second val.
 Data Conversion in different formats : If in source system date in in DDMMYY
format and in target the date is in DDMONYYYY format then this transformation
needs to be done at transformation phase.

6
Step 3 : Data Loading

 Data loading phase loads the prepared data from staging tables to main tables.

ETL process in SQL Server:

Following are the steps to open BIDS\SSDT.

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.

7
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).

8
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.

9
Step 4 − In the above screen, select any one option from the listed five options based on your
requirement to work with Analysis services.

ETL Process in Power BI

1) Remove other columns to only display columns of interest

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.

10
3. Change the data type of the UnitsInStock column

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).

3. Expand the Order_Details table


The Orders table contains a reference to a Details table, which contains the individual
products that were included in each Order. When you connect to data sources with multiples
tables (such as a relational database) you can use these references to build up your query

11
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.

4. Calculate the line total for each Order_Details row


Power BI Desktop lets you to create calculations based on the columns you are importing, so
you can enrich the data that you connect to. In this step, you create a Custom Column to
calculate the line total for each Order_Details row.
Calculate the line total for each Order_Details row:
1. In the Add Column ribbon tab, click Add Custom Column.

12
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.

5. Rename and reorder columns in the query


In this step you finish making the model easy to work with when creating reports, by
renaming the final columns and changing their order.
1. In Query Editor, drag the LineTotal column to the left, after ShipCountry.

13
2.Remove the Order_Details. prefix from the Order_Details.ProductID,
Order_Details.UnitPrice and Order_Details.Quantity columns, by double-clicking on each
column header, and then deleting that text from the column name.
6. Combine the Products and Total Sales queries
Power BI Desktop does not require you to combine queries to report on them. Instead, you
can create Relationships between datasets. These relationships can be created on any column
that is common to your datasets
we have Orders and Products data that share a common 'ProductID' field, so we need to
ensure there's a relationship between them in the model we're using with Power BI Desktop.
Simply specify in Power BI Desktop that the columns from each table are related (i.e.
columns that have the same values). Power BI Desktop works out the direction and
cardinality of the relationship for you. In some cases, it will even detect the relationships
automatically.
In this task, you confirm that a relationship is established in Power BI Desktop between the
Products and Total Sales queries
Step 1: Confirm the relationship between Products and Total Sales
1. First, we need to load the model that we created in Query Editor into Power BI
Desktop. From the Home ribbon of Query Editor, select Close & Load.

14
2. Power BI Desktop loads the data from the two queries.

3. Once the data is loaded, select the Manage Relationships button Home ribbon.

4. Select the New… button

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.

15
5. Select Cancel, and then select Relationship view in Power BI Desktop.

6. We see the following, which visualizes the relationship between the queries.

16
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.

17
Exercise - 3
Aim: Data Visualization from ETL Process

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.

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.

18
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.

Step 2: Interact with your report visuals to analyze further


Power BI Desktop lets you interact with visuals that cross-highlight and filter each other to
uncover further trends.
1. Click on the light blue circle centered in Canada. Note how the other visuals are
filtered to show Stock (ShipCountry) and Total Orders (LineTotal) just for Canada.

19
Exercise-4
Aim: Creating a Cube in SQL server 2012
Source Code:

Creating Data Warehouse

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).

1. Open SQL Server Management Studio 2008


2. Connect Database Engine
3. Open New Query editor
4. Copy paste Scripts given below in various steps in new query editor window one
by one
5. To run the given SQL Script, press F5
6. It will create and populate “Sales_DW” database on your SQL Server

Developing an OLAP Cube

For creation of OLAP Cube in Microsoft BIDS Environment, follow the 10 easy steps given
below.

Step 1: Start BIDS Environment

Click on Start Menu -> Microsoft SQL Server 2008 R2 -> Click SQL Server Business
Intelligence Development Studio.

20
Step 2: Start Analysis Services Project

Click File -> New -> Project ->Business Intelligence Projects ->select Analysis Services
Project-> Assign Project Name -> Click OK

Step 3: Creating New Data Source

3.1 In Solution Explorer, Right click on Data Source -> Click New Data Source

Step 3: Creating New Data Source

3.1 In Solution Explorer, Right click on Data Source -> Click New Data Source

21
3.2 Click on Next

3.3 Click on New Button

3.4 Creating New connection

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.

22
3.5 Select Connection created in Data Connections-> Click Next

3.6 Select Option Inherit

23
3.7 Assign Data Source Name -> Click Finish

Step 4: Creating New Data Source View

4.1 In the Solution Explorer, Right Click on Data Source View -> Click on New Data
Source View

24
4.2 Click Next

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.

25
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.

4.7 Assign Name (SalesDW DSV)-> Click Finish

26
4.8 Now Data Source View is ready to use.

Step 5: Creating New Cube

5.1 In Solution Explorer -> Right Click on Cube-> Click New Cube

27
5.2 Click Next

5.3 Select Option Use existing Tables -> 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

28
5.6 Select All Dimensions here which are associated with your Fact Table-> Click Next

5.7 Assign Cube Name (SalesAnalyticalCube) -> Click Finish

5.8 Now your Cube is ready, you can see the newly created cube and dimensions added in
your solution explorer.

29
Step 6: Dimension Modification
In Solution Explorer, double click on dimension Dim Product -> Drag and Drop Product
Name from Table in Data Source View and Add in Attribute Pane at left side.

Step 7: Creating Attribute Hierarchy In Date Dimension

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),

30
Step 8: Deploy the Cube

8.1 In Solution Explorer, right click on Project Name (SalesDataAnalysis) -- > Click
Properties

8.2 Set Deployment Properties First

31
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.

32
Step 9: Process the Cube

9.1 In Solution Explorer, right click on Project Name (SalesDataAnalysis) -- > Click Process

9.2 Click on Run button to process the Cube

33
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.

Step 10: Browse the Cube for Analysis

10.1 In Solution Explorer, right click on Cube Name (SalesDataAnalysisCube) -- > Click
Browse

34
10.2 Drag and drop measures in to Detail fields, & Drag and Drop Dimension Attributes in
Row Field or Column fields.

Now to Browse Our Cube

1. Product Name Drag & Drop into Column


2. Full Date UK Drag & Drop into Row Field
3. FactProductSalesCount Drop this measure in Detail area

35
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.

2. Click Scenario Manager.

36
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.

5. Enter the corresponding value 0.6 and click on OK again.

37
6. Next, add 4 other scenarios (70%, 80%, 90% and 100%).
Finally, your Scenario Manager should be consistent with the picture below:

38
Exercise 6
AIM :- Using the Data Modeling and Navigation

Source Code :

Using Data Modeling and Navigation

Data Modeling is one of the features used to connect multiple data


sources in BI tool using a relationship. A relationship defines how data
sources are connected with each other and you can create interesting
data visualizations on multiple data sources.

With the modeling feature, you can build custom calculations on the
existing tables and these columns can be directly presented into
Power BI visualizations. This allows businesses to define new metrics
and to perform custom calculations for those metrics.

In the above image, you can see a common data model, which shows
a relationship between two tables. Both tables are joined using a
column name “Id”.

Similarly, in Power BI, you set the relationship between two objects.
To set the relationship, you have to drag a line between the common
columns. You can also view the “Relationship” in a data model in
Power BI.

To create data model in Power BI, you need to add all data sources in
Power BI new report option. To add a data source, go to the Get data

39
option. Then, select the data source you want to connect and click
the Connect button.

Once you add a data source, it is presented on the right side bar. In
the following image, we have used 2 xls file to import data - Customer
and Product.

In Power BI on the left side of the screen, you have the following
three tabs −

40
 Report
 Data
 Relationships

When you navigate to the Report tab, you can see a dashboard and a
chart selected for data visualization. You can select different chart
types as per your need. In our example, we have selected a Table
type from available Visualizations.

When you go to the Data tab, you can see all the data as per the
defined Relationship from the data sources.

41
In the Relationship tab, you can see the relationship between data
sources. When you add multiple data sources to Power BI
visualization, the tool automatically tries to detect the relationship
between the columns. When you navigate to the Relationship tab,
you can view the relationship. You can also create a Relationship
between the columns using Create Relationships option.

You can also add and remove relationships in data visualization. To


remove a relationship, you have to right-click and select the “Delete”
option. To create a new “Relationship”, you just need to drag and
drop the fields that you want to link between the data sources.

42
You can also use the Relationship view to hide a particular column in
the report. To hide a column, right-click on the column name and
select the “Hide in report view” option.

Creating Calculated Columns

You can create calculated columns in Power BI by combining two or


more elements of the existing data. You can also apply calculation on
an existing column to define a new metric or combine two columns to
create one new column.

You can even create a calculated column to establish a relationship


between the tables and it can also be used to setup a relationship
between two tables.

To create a new calculated column, navigate to Data View tab on the

43
left side of the screen and then click Modeling.

When you navigate to the Modeling tab, you can see a New Column
option at the top of the screen. This also opens the formula bar,
where you can enter DAX formula to perform calculation. DAX- Data
Analysis Expression is a powerful language also used in Excel to
perform calculations. You can also rename the column by changing
the Column text in the formula bar.

In the following example, let us create a new column: Product Code


(Product_C), which is derived from the last three characters of Prod_Id
column. Then, write the following formula –

 Product_C = RIGHT( Sheet1[Prod_Id],3)

44
A long list of formulas is also provided that you can use for creating
calculated columns. You have to enter the first character of formula
to be used in calculations as shown in the following screenshot.

Creating Calculated Tables

You can also create a new calculated table in data modeling in Power
BI. To create a new table, navigate to the Data View tab on the left
side of the screen, and then go to the Modeling option at the top of
the screen.

45
DAX expression is used to create the new table. You have to enter the
name of a new table on the left side of the equal sign and DAX
formula to perform the calculation to form that table on the right.
When the calculation is complete, the new table appears in the Fields
pane in your model.

In the following example, let us define a new table - Table_CustC that


returns a one column table containing unique values in a column in
another table.

A new table is added under the “Fields” section in Power BI screen as


shown in the following screenshot. Once the calculated column and
calculated tables are created as per your requirement, you can use
the fields in the Report tab in Power BI.

To add these objects, you have to select a checkbox and a


relationship is automatically detected if possible. If not, then you can
drag the columns that you want to connect.

To view the report, you navigate to the Report tab and you can see
both “Calculated columns” and fields from the new “Calculated table”
in the report view.

46
Managing Time-Based Data

Power BI allows to drill through time-based data by default. When you


add a date field in your analysis and enable drill on your data
visualization, it takes you to the next level of time-based data.

Let us consider we have added Time-based table in Power BI


visualization. We have added Revenue and Year column in our report.

47
We can enable the drill feature in visualizations using the option at
the top. Once we enable the drill feature and click the bars or lines in
the chart, it drills down to the next level of time hierarchy.

Example: Years → Quarters → Months.

We can also use Go to the next level in the hierarchy option to


perform a Drill.

48
Exercise 7
Aim: Creating the Dash Boards

Source Code:
Creating Dashboards

In Power BI, you can create a dashboard by pinning visualizations


from BI reports that are published using Power BI desktop. All the
visualizations that are created using Power BI service are also
available for pinning to create dashboards.

In Power BI, if you want to pin a visual, open the BI report on the
Power BI service. At the top of the visual, select the pin icon.

When you use the Pin option as shown as shown in the above
screenshot, a new dialog box appears as shown in the following
screenshot. It asks you to create a new dashboard or select an
existing dashboard to put the visual from the dropdown list. If you
don’t have an existing dashboard, then this option is greyed out.

49
Once you click the Pin button, you will get a confirmation that your
visualization is “Pinned” to the dashboard. You can click My
Workspace and check the dashboard.

Once your dashboard is created, you can use different options to


configure the dashboard.

When you publish your BI report to Power BI service, you can share
reports and dashboards with other users in your organization. You
have to open the dashboard in Power BI service.

50
Exercise 8
AIM :- Develop power BI application with various operations in
Dashboard designer.

Source Code:

1. Connect to Data Sources

 Open Power BI Desktop: Start by launching Power BI Desktop.


 Connect to Data: Click on Home -> Get Data. You can connect to various data
sources like Excel, SQL Server, Web, and more. Choose your data source and load
the data into Power BI.

2. Transform and Clean Data

 Power Query Editor: Use the Power Query Editor to transform, clean, and shape
your data. You can remove columns, filter rows, change data types, and more.
 Create Relationships: If you're working with multiple tables, establish relationships
between them using the Manage Relationships feature.

3. Create Data Models

 Calculated Columns and Measures: Create calculated columns and measures using
DAX (Data Analysis Expressions) to perform complex calculations and aggregations.

DAX Introduction
DAX (Data Analysis Expressions) is a formula expression language and can be
used in different BI and visualization tools. DAX is also known as function
language, where the full code is kept inside a function. DAX programming
formula contains two data types: Numeric and Other. Numeric includes -
integers, currency and decimals, while Other includes: string and binary
object.

Following is an example of DAX formula, which uses a function to calculate a


column in a table.

51
DAX function can also include other functions, conditional statements, and
value references.

DAX Functions
In Power BI, you can use different function types to analyze data, and create
new columns and measures. It includes functions from different categories
such as −

 Aggregate
 Text
 Date
 Logical
 Counting
 Information

Power BI provides an easy way to see the list of all functions. When you start
typing your function in the formula bar, you can see the list of all functions
starting with that alphabet.

Aggregate Functions Counting Functions


DAX has a number of aggregate Other counting functions in DAX
functions. include −

 MIN  DISTINCTCOUNT
 MAX  COUNT
 Average  COUNTA
 SUM  COUNTROWS
 SUMX  COUNTBLANK

Logical Functions
Following are the collection of Logical functions −

 AND

52
 OR
 NOT
 IF
 IFERROR

TEXT Functions DATE Functions


 REPLACE  DATE
 SEARCH  HOUR
 UPPER  WEEKDAY
 FIXED  NOW
 CONCATENATE  EOMONTH

INFORMATION Functions
 ISBLANK
 ISNUMBER
 ISTEXT
 ISNONTEXT
 ISERROR

DAX Calculation Types

In Power BI, you can create two primary calculations using DAX −

 Calculated columns
 Calculated measures

Understand the following example:

When you navigate to the Modeling tab, you can see a New Column option at the top of the
screen. This also opens the formula bar where you can enter DAX formula to perform the
calculation. DAX - Data Analysis Expression is a powerful language used in Excel to
perform calculations. You can also rename the column by changing the Column text in the
formula bar.

53
In the following example, we have created a new column: Product Code (Product_C), which
is derived from the last 3 characters of Prod_Id column. Following is the formula Eg: −

Product_C = RIGHT( Sheet1[Prod_Id],3)

To create a calculated measure, navigate to New Measure tab under Modeling. This will add
a new object under the Fields tab with the name Measure.

54
 Hierarchies: Create hierarchies (like Year > Quarter > Month) to enable drill-down features
in your visuals.

How to create the Hierarchy in Power BI?


Now that you know what the hierarchy is let’s see how you can create
one.

I have a sample dataset including a product table with the columns below;

I want to create a hierarchy in a way that I have Category as level one,


and then Subcategory level 2, and Product as level 3.

Right-click on the field you want to set as level 1 of the hierarchy in the
fields list, and then select Create Hierarchy.

After that, you will see a new hierarchy created named your field name
“Category” plus the word “Hierarchy”. This would have a hierarchy icon
beside it and also an option to expand to the fields of the hierarchy. If you
expand, you will see a copy of the Category field in there too.

55
Note that the category field inside the hierarchy is just a reference to the
original category column. It is not a new column or duplicate.

Now to add another level to the hierarchy, you can either simply just drag
subcategory to the Category Hierarchy header or right-click on the
subcategory and use Add to hierarchy.

This adds that field as the second level of the hierarchy;

56
This is how simple you can create a hierarchy. If you continue it one more
time for the Product, you’ll have that as a third level of the hierarchy;

If you want to rename the hierarchy, you can do it by renaming the


Category Hierarchy itself. If you want to change the order of levels, you
can drag and drop them over each other. Now that you know how to
create a hierarchy, let’s see how it can be used.

How to use a hierarchy?


In the visualization tab of Power BI, you can simply drag and drop the who
hierarchy by adding the header into an axis of a chart and see all fields of
the hierarchy added there;

57
You can then

Hierarchy can be used for data exploration. With a structure like the
above hierarchies, you can easily drill down or up from a level to another
level. here is an example of drill down visualization;

Default Date hierarchy

Power BI uses a default date table, and if you use it, all the date fields looks like a hierarchy
of Year, Quarter, Month and Day. You can, of course, create any other hierarchies you like
but for that I suggest using a custom date table.

58
Hide original columns

A best practice when creating hierarchies is to hide the original columns. This would avoid
the confusion for the report users when they see two different version of the Category field.
one under the Category Hierarchy and one stand alone. You can hide the columns by simply
right click and hide in reports. Or hide them all at once using the model tab.

4. Designing the Dashboard

 Choose Visualizations: From the Visualizations pane, drag and drop visual
elements like bar charts, pie charts, line graphs, and tables onto your canvas.
 Customize Visuals: Format the visual elements by changing colors, labels, titles, and
more to match your design preferences.
 Slicers and Filters: Add slicers and filters to allow users to interact with the data and
drill down into specific areas of interest.

59
 Filters are useful for two distinct groups of people. First and foremost,
end users can expand the filter panel to display the available filters and
then filter the data accordingly.

How to Configure Filters

Filter types for string values

 Basic filtering: select which values of the dimension to include or exclude from the
full list of available values
 Advanced filtering: filter based on custom string logic for the dimension (ex.
“contains” or “does not contain”)
 Top N: filter the dimension to the top (or bottom) value of N based on another field
from the field list. N is a variable that you will specify.

Filter types for number values Filter types for date values

60
5. Interactive Elements

 Bookmarks and Selections: Use bookmarks to save the state of your report page, and
use the selection pane to manage layers and elements.
 Drillthrough Pages: Create drillthrough pages to allow users to click on data points
and navigate to more detailed reports.

##//// To refer drillthrough function Click here ////####

6. Advanced Operations

 Conditional Formatting: Apply conditional formatting to visuals, changing colors or


styles based on data values.
 Custom Visuals: Import custom visuals from the Power BI marketplace for
specialized needs.
 DAX Queries: Use DAX to create complex calculations that can be used in your
reports and dashboards.

##//// The Document is getting more so students to learn more about these operations
use the following pdfs.//////####

####////To know more about DAX Queries Click Here /////###

61
Exercise 9
Aim:- Develop a power BI application with Geographical Maps.
Source code:

Power BI maps are useful for understanding geographical trends or


analyzing spatial relationships for better decision-making .

You’ll find 6 in-built mapping options in Power BI to suit various


analytical needs, including:

 Basic map

 Filled map

 Azure map

 Tree map

 ArcGIS map

 Shape map (only available in Power BI desktop preview)

62
How to create maps in Power BI
Step 1. Get and prepare data

To create any map in Power BI, you need to have data with location-
based details. For the examples below, we use a sample dataset
(AmazingMartEU2Geo). It contains a list of orders from different
countries, cities, and regions in Europe along with other information.
You can also automate data load to Power BI from your sources using
Coupler.io. It is a reporting automation solution that supports 60+
apps, such as Google Analytics, Hubspot, Google Ads, and more.
Simply select your desired source in the form below and
click Proceed.
You’ll be offered to create a Coupler.io account for free and set up the
connections.

Keep in mind that to create maps in Power BI, your data meets the
correct geo-location formatting requirements:

 Ensure your dataset has location-based details, such as


country, state, city, postal/ZIP code, or latitude and longitude
coordinates.

 Standardize location names, spellings, and formats to prevent


discrepancies in your map visualizations.

 Confirm the consistency and accuracy of your location-based


data with geographic hierarchies and naming and categories.
Step 2. Enable Map Settings
If you are creating maps in Power BI for the first time, you need to
enable the map settings from the Power BI service admin portal.
Otherwise, you will see a warning ‘Map and Filled Map Visuals aren’t
Enabled’.

63
 To solve this issue, log in to the Power BI desktop and Power BI
service using the same email

 Go to your Power BI Service account


 Click on the gear icon i.e. Settings ➡ Admin portal
 Next, select the Tenant settings. Enable the options related
to AcrGIS maps, Azure and filled maps.

You’ll need to wait for 15 minutes. The same functionalities will be


also applied to the Power BI desktop automatically to create a map.

Step 3. Add map visuals and customize


them
After preparing and loading the dataset, simply drag-and-drop and
customize the preferred map in Power BI.

64
Go to the Visualizations ➡ Format visual. Here you will find 2
options to personalize the map: Visuals and General settings.
The Visual settings are different depending on the type of map you
choose.

The General settings include the customization options for titles,


effects, header icons, showing/hiding tooltips, using ALT
text, etc. These general properties are the same for all types of
Power BI maps.

We’ll show how to create different types of Power BI maps and

65
customize them for geographical analytics and reposting in detail in
the following section.

66
Exercise 10
Aim:- Using the Power BI to create geocoding on maps and
visualize spatial distributions.

Source Code:

How to create Power BI basic maps

After loading a map dataset inside your Power BI, you can see
the Visualizations pane on the right side of the canvas.
Here, you’ll find the icon of Map (basic). Drag and drop the basic
map icon inside the Power BI report. You can expand the map for a
better view and analytics.
Next, select the country or city and drag it inside the Location tab.
Within seconds, you can see the bubbles identifying the European
countries.

In the Power BI basic map, you can also show the bubble size of the
geographical locations. For instance, drag the Order ID in the bubble
Size tab to show how many orders the shop gets from each country.

67
You can see the different sizes of bubbles, depicting the number of
orders. Large bubbles mean more orders, and smaller bubbles mean
fewer. You can simply hold the cursor over the bubbles, it will show
the relevant information e.g. country name and the Count of order in
the tooltip.

##<Main part or procedure in the experiment>##

Step 1: Prepare Your Data

1. Collect Data: Ensure your dataset contains geographic


information, such as addresses, city names, postal codes, or
latitude and longitude coordinates.

2. Clean Data: Clean your data to ensure accuracy and


completeness. Remove any duplicates, correct any errors, and
standardize the formats.

Step 2: Load Data into Power BI

1. Open Power BI Desktop.

68
2. Import Data: Click on Get Data and select the data source
(e.g., Excel, SQL Server, etc.).

3. Load Data: Follow the prompts to load your data into Power BI.

Step 3: Create a Map Visualization

1. Add a Map Visual:

o In the Visualizations pane, select the map visual icon


(Map or Filled Map).

2. Assign Data to the Map:

o Drag your geographic fields (e.g., addresses, city names,


postal codes, latitude, and longitude) into the Location
bucket of the map visual.

o Optionally, you can drag a numeric field (e.g., sales,


population) into the Size bucket to represent the data's
magnitude.

3. Geocode Data:

o Power BI automatically geocodes the data if it recognizes


the geographic fields.

o If your data includes latitude and longitude, drag these


fields into the corresponding Latitude and Longitude
buckets for precise mapping.

# For Example:-

Creating a Map Using ArcGIS for Power BI

69
(ArcGIS is a built-in visual in Power BI. You can find it among all other
visualization choices. We have a course on data visualization in
Power BI if you'd like extra guidance on visualizing data in Power BI
and the best practices.)

Click the ArcGIS icon to add it to the Power BI canvas. In the options
on the right-hand side, you will see the types of fields that this visual
supports. We add the neighborhood column to the Location field and
the latitude and longitude columns to their respective fields. We want
to visualize the prices of Airbnb listings in Los Angeles, so we add the
price column to the Size field.

This produces the following result:

70
In addition to the information in our dataset, we add an additional
infographic card to the chart. This is a feature offered by ArcGIS, and
it dynamically changes based on the items we can see - in this case,
we have zoomed into Los Angeles. Since we are dealing with property
data, we added the average home value. This adds some context to
the relative prices of Airbnb listings we see in this visual.

Based on the size of the circles, we can see that Malibu has some of
the most expensive Airbnb listings!

Step 4: Customize the Map Visualization

1. Adjust Map Style:

o Click on the map visual to select it.

o Use the Format pane to adjust various settings such as


map theme, bubble size, color, and more.

2. Filter Data:

o Use filters to focus on specific subsets of your data. Add


slicers or use the Filter pane to apply filters to your map.

71
3. Add Tooltips:

o Drag fields into the Tooltips bucket to show additional


information when hovering over data points on the map.

Step 5: Analyze and Share Your Map

1. Analyze Data:

o Interact with your map to explore patterns, trends, and


outliers in your spatial data.

o Use Power BI's cross-filtering and cross-highlighting


features to see how changes in one visual affect others.

Customize basic maps in Power BI


You can customize the following styles inside the Visual tab.

 Map Settings: You can choose the Power BI map styles such
as Arial, Dark, Light, Grayscale and Road. Select any of
them from the drop-down to change the map theme instantly.
You can also show or hide the map labels as well.

 Controls: Enable automatic zoom control and zoom button

72
 Legend: Turn on/off the legend value
 Bubbles: Select custom bubble scaling, size, and color

 Category labels: Customize the category labels, colors, and


background
 Heat map: Enable/disable the heatmap option.

Power BI ArcGIS maps


ArcGIS Maps for Power BI is a built-in mapping visualization tool
within Microsoft Power BI. It allows you to create interactive maps
and leverage spatial analysis to reveal geographic trends and
relationships within their data.
Key Features:
 Access to a wide range of geographical data or reference
layers.

 Supports complex mapping like heatmaps and clustering.

 Interactivity features such as zoom, pan, and tooltip.


Use Cases:
 Spatial Analysis: Identify spatial patterns, clusters, and
relationships.
 Highly Customized Sales Territory Maps: Shows sales
territory maps with specific colors, markers, and data overlays
for detailed analysis.

73
 Environmental Monitoring: Track air quality, water pollution,
and natural disasters in real-time.
Limitation(s):
 Has a steeper learning curve compared to other mapping
options.

How to make ArcGIS maps for Power BI


Open an existing report or create a new one in Power BI Desktop. In
the Visualizations pane on the right side, find the ArcGIS for Power
BI icon and click it. An empty map template will appear on your
report canvas.
On the right side, there will be fields for Location and Latitude and
Longitude depending on your data format.
Drag and drop your location field into the Location field or enter the
appropriate latitude and longitude fields. You can also categorize
based on color by adding value in the Color field.
Power BI will automatically populate the map with your data points
with spatial data to visualize and gain advanced demographic
insights.

74
Customize ArcGIS maps in Power BI
The customization settings of ArcGIS are different from other Power BI
maps. You will find a hamburger menu icon over the created map
at the top left corner. Click on it, you can see multiple options to
personalize your ArcGIS map, such as:
 Active Layer: Manage which data layer is emphasized on the
map i.e. coordinates.
 Search field: Enable search functionality to find specific
addresses or locations on the map.
 Coordinates: Display latitude and longitude coordinates for
data points.
 Basemap: Change the underlying background map style or
theme such as Grey Scale Canvas, Light Scale Canvas, Open
Street Map, and Streets.

Additional settings: You can also see additional settings for further
customization. You can show the selected region
with Infographics such as population, age, housing, health,
education, etc.

75
You can also add a reference layer, and find the drive/buffer time in
the ArcGIS map. Choose your input layer e.g. Coordinates and then
select your location using the selection shape like arrow, circle,
rectangle, etc. After that, select the analysis time from the drop-
down, including Ring buffer and Drive time. Next, write the time
and click on Run Analysis.
For instance, we select the 30-minute distance locations from the city
of Exeter. The ArcGIS map shows all the destinations that one can
reach within 30 minutes of driving from the city.

76
Along with these, common customizations are also available for
ArcGIS maps in Power BI. You can find the Visual and General settings
on the Format Visuals tab. Here you can customize the layout, zoom
control, location type, title, effects, header icons, etc.
<Additional Information>
Power BI filled maps
Filled maps in Power BI go beyond basic location data distribution.
They use color intensity to reveal areas with high or low
concentrations of your chosen data point. For instance, you can show
sales figures using a filled map where red areas represent high-selling
regions, while blue areas indicate lower sales.

They provide a visually compelling way to compare data across


regions and identify patterns or trends.
Key Features:
 Color gradients highlight data concentrations.

 Pattern identification to spot geographic trends easily.

 Quickly compare data across regions.


Use Cases:

77
 Sales Performance Analysis: Identify top-performing
regions.
 Customer Concentration: Target areas with high customer
density.
 Resource Allocation: Visualize and adjust resource
distribution.

How to create Power BI filled maps


Go to the Visualizations pane. Next, locate the filled map icon and
drag it onto your report canvas.
To display the geographical map, assign Location (e.g. country) and
data fields such as Legend (Region). The legend in Power BI Filled
Map provides a key to interpret the colors representing data
categories or ranges.
Here the Central, North, and South regions are categorized by filling 3
different colors.

Customize filled maps in Power BI


To customize filled maps, you need to navigate to the Format
visual option. Here, you will find the following options to change the
visual styles and general settings.

78
 Map settings: Customize the filled map theme from the
available 5 styles
 Legend: Enable or disable the legend data value
 Fill colors: Select your preferred color to fill the specific areas.
 Tooltips: Add hover tooltips for region-specific data values.

Power BI Azure maps


Power BI Azure Maps integrate Microsoft Azure’s cloud-based
mapping services into Power BI. This map offers advanced mapping
capabilities and access to a wide range of geographical data layers.

These maps enable users to visualize and analyze spatial data


with real-time traffic information, weather data, and more.
Key Features:
 3D view for spatial analysis and visualization.

 Access to real-time traffic, weather, and dynamic geographical


information

 Support for routing, geocoding, and spatial analytics.


Use Cases:

79
 Logistics Optimization: Analyze routes and minimize delivery
times with real-time traffic data.
 Location Intelligence: Understand customer demographics
and market trends using spatial data.
 Asset Management: Monitor and track the location of assets,
vehicles, or equipment using geofencing.
Limitation(s)
 Limited to 30,000 data points (latitude/longitude or locations)

How to create Azure maps Power BI


Creating Azure maps in Power BI is similar to the basic/filled maps.
You need to drag the Azure map icon and drop it inside the Power BI
dashboard.
After that, set the value for geographical presentation such as
Country as Location and Count of Region as Size. You can see the
bubbles based on the given value. Hover over the bubble-sized to
get the associated information of the country and number of regions.

80
Customize Azure maps in Power BI
Azure Map offers extensive customization options in Power BI. In
addition to the styling options like general settings, and themes, you
will find multiple control options. You can turn on/off the controls
for World wrap, Style picker, Navigation and Selection.

Selection Mode: Selection is an amazing customization option for


Azure maps. Click on the icon at the right top corner over the map.
You can see 4 options including Range selection. Using this option,
you can simply set a custom value for a specific time or
distance to search your desired location.
You can also draw a rectangular, circle or polygon area on the map
interface to specify a specific geographic region.

81
Traffic Layer: Another interesting option in Azure maps is the traffic
layer. You can find real-time data on traffic for your specific region.
Simply turn on the Traffic layer and zoom in to the desired location.
You can see the real-time traffic conditions of the selected area.

3D Column Layer: Enable the 3D Column Layer on an Azure map to


visually present data with vertical columns indicating values or
attributes at specific locations.

82
<Additional Information>
Power BI treemaps
Power BI Treemaps are visualizations that display hierarchical
data using nested rectangles. Each rectangle represents a specific
category or subcategory. They provide a compact and efficient way
to visualize data in Power BI with hierarchical structures and compare
data values across different levels.
Key Features:
 Hierarchical data display with customizable formatting.

 Drill down for deeper insights.

 Integrated with Power BI for interactive analysis.


Use Cases:
 Sales Analysis: Visualize product sales by categories for
performance insights.
 Organizational Structure: Display departmental hierarchies
for resource management.
 Budget Allocation: Analyze expense categories for cost
optimization.
Limitation(s)
 Complex and large datasets can clutter treemaps.

83
How to make Power BI treemaps
To create a treemap, connect to your data source and load the
relevant dataset into Power BI. Next, select the Treemap icon to add
a treemap to your report canvas from the Visualizations pane.
Also, drag the desired hierarchical data fields (categories and
values) from your dataset into the appropriate fields in the treemap
visualization.
Power BI will automatically generate the treemap based on the
hierarchical structure of your data, with rectangles representing
categories and given values.

For our case, we wanted to depict the regional data of each country.
Where the larger the rectangle is, the more regions the country has.
You can simply see the exact number via the tooltip by hovering over
the particular rectangle.

84
Customize treemaps in Power BI
In the format Visual tab, you will find treemap customization options
such as:

Legend: Customize legend settings for treemaps in Power BI for


improved visualization clarity.
Color: Set your preferred color schemes to enhance data
representation within treemaps in Power BI.
Data label: Adjust data label appearance and positioning to provide
additional insights within treemaps.
Category label: Customize category labels for treemaps in Power BI
to improve data categorization and understanding.

85
Exercise 11
Aim:- Create an interactive exploration of maps using Power
BI
Source Code:
Prerequisite: Power BI – Timeseries,
Aggregation, and Filters

some important concepts used to create interactive


dashboards so as to make large business intelligence
decisions. We will be discussing the following
topics :
1. Maps
2. Scatter plots
3. Interactive BI Reports
Dataset Used:
The Excel file ‘AmazingMartGeo‘ contains the 2
tasets-
1. ListOfOrders
2. OrderBreakdown.

On uploading the dataset in Power BI, it gets automatically


joined. (You can read about different types of JOINS IN SQL to
know the different ways datasets can be joined together).
You can download the dataset from here: DATASET. The
datasets are joined as shown in Fig 1.

Fig 1: Power BI: Joins b/w datasets

86
Maps:
Using a Power BI map is a great way to visualize
data that represent locations. With visually
appealing maps and easy-to-understand content,
your users will be able to gain more insight into your
data. Before using Maps in Power BI, we need to
first understand how to create and work
with Hierarchies within the given dataset.
Steps Involved:

Step 1 - Select and expand the 'ListOfOrders' dataset


from Fields panel.
Step 2 - Select 'state' and 'city' columns one by one
and drag and drop them
into 'country' column.

This will create a new hierarchy column in the


dataset. Rename it as 'Geography'.
(As shown in fig 2)

Fig 2: Power BI: Creating Hierarchies

After creating the Geography hierarchy, follow the


steps given below to create a Map in Power BI.

87
Steps Involved:

Step 1 - Select 'Map' from Visualization panel and


drag & drop it into report view.
Step 2 - Drag Geography from Fields panel and drop
into the Location.
Step 3 - Drag lat and lon from Fields panel and drop
into Latitude and Longitude.(As shown in fig 3)

Fig 3: Power BI: Map

If we perform Drilling into this map and


expand down levels into the hierarchy, we can
we the states and cities involved in the
dataset as well. (As shown in Fig 4)

Fig 4: Power BI: Drilling into hierarchies

Note:- the below image is for understanding


purpose.

88
Fig 5: Power BI: Column vs Measure

Now that we understand the major differences


between Column and Measure, let us create a
calculated measure of our own.

Steps Involved

Step 1 - Go to 'OrderBreakdown' dataset in Fields


panel and expand it.
Step 2 - Right click on it and click on 'New Measure'.
Step 3 - Now go the 'Formula Bar' under the Power BI
Ribbon and type the following code.

This will create a calculated measure (ProfitMargin)


in the OrderBreakdown dataset. (as shown in Fig 6)

Fig 6: Power BI: Creating calculated measures

89
Scatter Plots:

A Scatter Chart or Scatter plot is a very useful tool to


visualize the relationship between two sets of data.
It has two value axes to show-
 Horizontal axis: a set of numerical data.
 Vertical axis: a set of numerical values.
Steps Involved:

Step 1 - Select the scatter chart from the


Visualization panel and drag it into the report view.

Step 2 - From the Fields section, expand


'OrderBreakdown' dataset. Then drag and drop
2.a - Sales to x-axis
2.b - Profit to y-axis
2.c - Customer Name to details (As shown in Fig
7)

Fig 7 : Power BI : Scatter Charts


Step 3 - Now, go to Format --> Data colors -->
Default color --> Conditional formatting.

Step 4 - Do the following :


4.a - Set Based on field to ProfitMargin.
4.b - Set Min/Max colors for ProfitMargin.
4.c - Press OK.

(As shown in fig 8)

90
Fig 8 : Power BI : Conditional Formatting
On following the above steps, we get a schematic,
color coded Scatter plot. (As shown in Fig 9)

Fig 9 : Power BI: Formatted Scatter Chart

Introduction to an Interactive Business


Intelligence Report:

An Interactive BI Report provides a new way to


display your Excel data in a variety of eye-catching,

91
interactive reports. You can add various multiple
visualizations to get important information out of
the report. Here is an example BI Report containing
maps, scatter plots, slicers and donut chart.
Steps Involved:
Step 1 - Create a new page.
Step 2 - Simply copy your previous visualizations
(Map and Scatter plot) and paste it onto the new
page.
Step 3 - Drag and drop two slicers from Visualization
pane. Then, from the 'ListOfOrders' dataset drag and
drop :
3.a - OrderDate into first slicer.
3.b - Region into second slicer.

(As shown in Fig 10)

Fig 10: Power BI: Interactive BI Report


Note: You can always go to the Format panel of each of
these visualizations and change its aspects like Text
size, color etc.
As per your preferences.

Donut Chart:

A doughnut chart is similar to a pie chart as it shows


the relationship of parts to a whole. The only
difference is that the centre is blank and allows

92
space for a label or icon.
Steps Involved:
Step 1 - Select 2 Donut chart from the Visualization
panel and drag it into the Report view.
Step 2 - Select OrderDate from'ListOfOrders' dataset
and drag it into the donut chart.
Step 3 - Select Profit from 'ListOfOrders' dataset and
drag it into the values section. (as shown in Fig
11)

Fig 11: Power BI: Donut Chart

Making Interactive BI Reports is an important skill


used by businessmen around the world to make
important company decisions. Above is one of the
examples of making a Report on Power BI. You can
use various visualizations. Combine them with filters
and slicers to create a business intelligence report of
your own. For doubts/queries, comment below.

93
Exercise 12
Aim:- Develop power BI application with MongoDB

Source Code:

Connect from Microsoft Power BI Desktop

Procedure

Procedure

Follow these steps to enable Atlas SQL and connect with Power BI.

Enable Atlas SQL.

1. In Atlas, go to the Clusters page for your project.

a. If it's not already displayed, select the organization that contains your desired
project from the Organizations menu in the navigation bar.

b. If it's not already displayed, select your desired project from


the Projects menu in the navigation bar.

c. If the Clusters page is not already displayed, click Database in the sidebar.

The Clusters page displays.

2. Under Atlas SQL, click Connect.

a. On the lower right side of the cluster card under Atlas SQL, click Connect.

b. If the Introducing the Atlas SQL Interface dialog box displays, click Get
Started.

3. Click Quick Start

94
Quick Start configures a federated database instance for your cluster with the
default settings.

To set up Advanced Configuration, including querying across Atlas data sources or


limiting the namespaces to query, you must Manually Create a Federated Database
Instance for Atlas SQL.

4 Under Create an Atlas SQL Connection for this cluster, click Create.
5. Under Select your driver, select Power BI Connector.
6. Under Get Connection String, select a database and copy the URL.

The URL is required to connect from Power BI Desktop.


2. Download the MongoDB ODBC Driver.

Download the installer for the latest MongoDB ODBC Driver.

NOTE

To use Direct Query, you must install MongoDB ODBC Driver version 1.2 or later.
3
Download and install the MongoDB Atlas Power BI Connector.

NOTE

The MongoDB Atlas Power BI Connector is included with Power BI Desktop. If your
version of Power BI Desktop already has the MongoDB connector, you can skip this
step. To use a different version than the one bundled with Power BI Desktop,
complete this step.
1

Download the connector file.

2
Move the connector file to the following directory path: C:\Users\<user>\Documents\
Power BI Desktop\Custom Connectors .

Create this folder if it doesn't already exist.


3. Connect from Power BI Desktop.

95
1. Open Power BI Desktop.
2. Select Get data from the Home menu.
3. Find and select the MongoDB Atlas SQL connector.

a. Type mongo in the search bar to find the new connector.

b. Select MongoDB Atlas SQL.

c. Click Connect.

96
4. Enter the URI and the database name and click OK.

The MongoDB URI is the URL is the from the previous step.

You can also enter a SQL query in the Native query field. Power BI uses the SQL
query as the direct source for the data.

97
5. Enter your Atlas User name and Password and click Connect.

By default, a user can access all clusters and federated database instances in
projects to which they have access. If you restricted access to specific clusters and
federated database instances, you can grant access to the new federated database
instance in the Edit User menu. To learn more, see Modify Database Users.

Begin Working with Power BI

Your selected data is available for use with Power BI's visualization
tools.

--------o END o--------


98

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy