0% found this document useful (0 votes)
260 views40 pages

Power BI Question Bank

Uploaded by

harivirat2005
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)
260 views40 pages

Power BI Question Bank

Uploaded by

harivirat2005
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/ 40

Unit – I

2 Marks
1. Difference between Power BI and Tableau

Both Tableau and Power BI are the current IT industry's data analytics and visualization giants. Yet,
there are a few significant differences between them. You will now explore the important differences
between Tableau and Power BI.

Tableau Power BI

Tableau uses MDX for measures andPower BI uses DAX for calculating measures
dimensions

Tableau is capable of handling largePower BI is qualified only to handle a limited


volumes of data amount of data

Tableau is best suitable for experts Power BI is suitable for both experts and
beginners

Tableau User Interface is complicated Power BI User Interface is comparatively


simpler

Tableau is capable of supporting thePower BI finds it difficult, as its capacity to


cloud with ease. handle large volumes of data is limited.

2. What is Power BI?

Power BI is a business analytics tool developed by Microsoft that helps you turn multiple unrelated
data sources into valuable and interactive insights. These data may be in the form of an Excel
spreadsheet or cloud-based/on-premises hybrid data warehouses. You can easily connect to all your
data sources and share the insights with anyone.

3. Why should we use Power BI?

Because Power BI provides an easy way for anyone, including non-technical people, to connect,
change, and visualize their raw business data from many different sources and turn it into valuable
data that makes it easy to make smart business decisions.
4. What is Power BI Desktop?

Power BI Desktop is an open-source application designed and developed by Microsoft. Power BI


Desktop will allow users to connect to, transform, and visualize your data with ease. Power BI
Desktop lets users build visuals and collections of visuals that can be shared as reports with your
colleagues or your clients in your organization.

5. What is Power Query?

Power Query is a business intelligence tool designed by Microsoft for Excel. Power Query allows
you to import data from various data sources and will enable you to clean, transform and reshape
your data as per the requirements. Power Query allows you to write your query once and then run it
with a simple refresh.

6. Mention some advantages of Power BI.

Some of the advantages of using Power BI:


● It helps build an interactable data visualization in data centers
● It allows users to transform data into visuals and share them with anyone
● It establishes a connection for Excel queries and dashboards for fast analysis
● It provides quick and accurate solutions
● It enables users to perform queries on reports using simple English words

7. List out some drawbacks/limitations of using Power BI.

Limitations in using Power BI:


● Power BI does not accept file sizes larger than 1 GB and doesn't mix imported data
accessed from real-time connections.
● There are very few data sources that allow real-time connections to Power BI reports and
dashboards.
● It only shares dashboards and reports with users logged in with the same email address.
● Dashboard doesn't accept or pass user, account, or other entity parameters.

8. Name the different connectivity modes available in Power BI?

There are three main connectivity modes used in Power BI.


SQL Server Import
An SQL Server Import is the default and most common connectivity type used in Power BI. It allows
you to use the full capabilities of the Power BI Desktop.
Direct Query
The Direct Query connection type is only available when you connect to specific data sources. In this
connectivity type, Power BI will only store the metadata of the underlying data and not the actual
data.
Live Connection
With this connectivity type, it does not store data in the Power BI model. All interaction with a report
using a Live Connection will directly query the existing Analysis Services model. There are only 3
data sources that support the live connection method - SQL Server Analysis Services (Tabular models
and Multidimensional Cubes), Azure Analysis Services (Tabular Models), and Power BI Datasets
hosted in the Power BI Service.
9. Name the data sources can Power BI can connect to?

Several data sources can be connected to Power BI, which is grouped into three main types:
● Files
It can import data from Excel (.xlsx, .xlxm), Power BI Desktop files (.pbix) and Comma-Separated
Values (.csv).
● Content Packs
These are a collection of related documents or files stored as a group. There are two types of content
packs in Power BI:
● Content packs from services providers like Google Analytics, Marketo, or Salesforce and
Content packs are created and shared by other users in your organization.
● Connectors
Connectors help you connect your databases and datasets with apps, services, and data in the cloud.

10. Explain the building blocks of Microsoft Power BI.

The important building blocks of Power BI are as follows:


Visualizations
Visualization is the process of generating charts and graphs for the representation of insights on
business data.
Datasets
A dataset is the collection of data used to create visualization, such as a column of sales figures.
Dataset can get combined and filtered from a variety of sources via built-in data plugins.
Reports
The final stage is the report stage. Here, there is a group of visualizations on one or more pages. For
example, charts and maps are combined to make a final report.
Dashboards
A Power BI dashboard helps you to share a single visualization with colleagues and clients to view
your final dashboard.
Tiles
A tile is an individual visualization on your final dashboard or one of your charts in your final report.
10 Marks
1. Create and modify reports by using Power BI
Power BI is a tool that promotes data exploration. By using Power BI tools, you can interactively
explore data to truly understand it. You can pivot columns, change the shape of charts, filter data, and
share reports. These reports can then be embedded within a workspace in finance and operations
apps. Power BI is especially useful for creating dashboards and non-document reports or any report
that does not require printing.
Ready-made Power BI reports are available in Lifecycle Services and the PowerBI.com marketplace.
However, sometimes you will need to create and modify your own Power BI reports.
Create a Power BI report with finance and operations apps data
To create a report, you will need to use a finance and operations development environment, Visual
Studio, and either Power BI Online or Power BI Desktop. Power BI uses the Open Data Protocol
(OData) endpoints that are available from finance and operations entities. To connect to Dynamics
365 Unified Operations data, you can connect using an OData feed in Power BI. You can then select
the database and entities that you want to load.
When you have the data loaded, you can drag fields to the canvas to manipulate the data. You can
select from a variety of visualizations to explore data, create calculations, and combine multiple
aggregate measurements. After the report is finished, you can then push the report to your production
environment.
Watch the following video to learn how to connect to your data in finance and operations by using
Power BI:
Modify a Power BI report
Unlike SSRS reports, which require multiple reports to see different views of the same data, Power
BI can be used for quick and simple manipulation of how your data is viewed. You can adjust
existing reports to filter data as you need it.

Create and deploy a report


This exercise uses the standard demo data set available in finance and operations apps.
First, you need to create a query.
1. Open Visual Studio as administrator.
2. From the File menu, select New > Project. Select the Finance Operations template in the
middle pane or by searching for it. Enter ReportingProject in the Name field. Select OK.
3. In the Solution Explorer, right-click your project node, and then select Add > New Item.
4. Select Data Model and then select Query.
5. For the Name field, enter FMVehicleModelQuery and then select Add.
6. Open the Application Explorer view, if it is not already open.
7. In the AOT, open Data Model > Tables, and then select and drag FMVehicleModel
table to the data source of your query.
8. In the properties of the QueryRootDataSource FMVehicleModel, set the Dynamic
Fields property to Yes.
9. Select Save all.
10. Right-click the Project and build (Ctrl+Shift+B).
Now, you will create the report.
1. In the Solution Explorer, right-click your project node and then select Add > New Item.
2. Select the Reports node on the left pane and then select Report on the middle pane.
3. In the Name field, type FMVehicleModelReport and then select Add.
4. Right-click the Datasets node and then select New Data Set.
5. In Properties, set the Dynamic Filters property to True.
6. Enter FMVehicleModelDS in the Name property.
7. Select the Query property and then select the ellipsis (...) to view a list of Queries.
8. On the Select a Query page, select FMVehicleModelQuery and then select Next.
9. Select the All Fields check box and then select OK.
10. Drag and drop FMVehicleModelDS from the Datasets node to the Designs node.
11. On the Designs node, expand the newly created AutoDesign1.
12. Expand the FMVehicleModelDSTable1.
13. On the Datasets node, expand the FMVehicleModelDS.
14. Expand the Fields node if it is not already expanded.
15. Drag and drop Make_Make from the Fields node to Designs > AutoDesign1 >
FMVehicleModelDSTable1 > Groupings.
16. Save all.
17. Right-click Solution and build (Ctrl+Shift+B).
18. In the Solution Explorer, right-click FMVehicleModelReport and then select Deploy
Reports.
Next, you will create a menu item to run the report.
1. In the Solution Explorer, right-click your project node and then select Add > New Item.
2. Select User Interface and then select Output Menu Item.
3. Name the Output menu item FMVehicleModelReport and then select Add.
4. Drag the FMVehicleModelReport report from the Solution explorer onto the Menu Item
that you just created.
5. Save all.
6. Right-click Solution and build (Ctrl+Shift+B).
Finally, you will run the report.
1. In the Solution explorer, select the FMVehicleModelReport Output menu item, and then
right-click and select Set as Startup object.
2. Select Start on the Standard Toolbar in Visual Studio.

2.Types-Power BI Dev & Prod Environments


Most corporate IT/BI departments utilize Development, Test, and Production environments to release
reports to the business. Here’s how to accomplish that in Power BI. While Power BI doesn’t offer one
specific method to work through this progression, there are several options that can be utilized via
Workspaces and Apps.
Handling Dev/Test/Production Environments Option 1:

This option offers the most straightforward and simplistic model. It involves setting up on singular
Workspace to be utilized as a “Dev” environment. Here, the report creator (and other collaborating
members) can publish a report to the Workspace and make changes without end users being able to
see. When the development team is finished with their changes, they can push to the corresponding
App, which acts as a “Prod” environment.
The biggest issue with this method is that there isn’t a designated “Test” environment. Technically
the report creator(s) could do a direct report share with Test users during the User Acceptance
Testing(UAT) phase. The downside with this option is that while UAT is going on, no additional
development can happen without the testers immediately seeing the changes. Also, if the report needs
to reference different database connections (Dev, Test, Prod), this option makes it unable to reference
both Dev and Test.
Handling Dev/Test/Production Environments Option 2:
The second option offers a more robust solution with entirely different Workspaces for
Dev/Test/Prod, including corresponding Apps for Test and Prod. A report would be created and
published to a Dev Workspace. Once ready, it would then be re-published to a Test Workspace (with
new database connections, if necessary). The App would be created to allow testers for the UAT
phase. When that phase is complete, the report would finally be re-published to a Prod Workspace. A
Prod App would be created to allow for the end users to view the report.
While this is certainly the more ideal way to handle the report progression, it also involves much
more upkeep. The first method involved managing two elements (1 Workspace, 1 App), but this
method involves managing five elements (3 Workspaces, 2 Apps). Remember that all of this setup is
for one subject matter and/or end users. If you’re in a BI team that creates reports for Finance,
Marketing, HR, etc., this five-element setup needs to be multiplied for each of those groups.
Handling Dev/Test/Production Environments Option 3:

While those are the two main options suggested in the white paper, there is another solution that
could be a happy-medium. This option includes a Development Workspace where the initial report
would be published. When ready for UAT, the report would be re-published in a separate Test
Workspace and testers would be given access to the report. Once vetted, the report would be pushed
to the App, which would serve as a Production environment where end users would be given access.
This option offers a designated place for all three phases, while limiting the amount of upkeep. And if
you want to limit the upkeep even more, you can reuse the Development workspace as a repository
for all reports in development, regardless of the subject matter.

3. Installing power BI desktop


Power BI desktop is the free authoring tool for your Power BI datasets and reports.
There are the following two ways to download and install Power BI Desktop:
1. Download from the Microsoft Store
2. Direct download from microsoft.com
Updates to Power BI Desktop are released regularly, and to receive the automatic updates—you
need to download from the Microsoft Store.
If you directly download Power BI Desktop from the website, you will need to
manually check and install the updates. In an organization, access to downloading software is
often tightly controlled by the IT department. This can restrict how and when installations occur.
Because of this, it is not unusual for different organizations, or even colleagues in the same
organization, to have a slightly different version of Power BI Desktop.
Downloading from the Microsoft store
To download Power BI Desktop, follow the following steps:
1. Open a Web browser and navigate to the following URL—https://powerbi.
microsoft.com/en-us/desktop/
2. Click on the Download free button

3. You may be prompted to open the Microsoft store application. Click on Open.

4.The Microsoft Store opens and takes you directly to the Power BI Desktop
download page. Click on Install.
That is all you need to do. Power BI Desktop will automatically update, so you can
be sure that you always have the latest version of the software.

Downloading directly from Microsoft.com


Following are the steps to download Power BI Desktop directly from the website:
1. Open a Web browser and navigate to the following URL—https://powerbi.
microsoft.com/en-us/desktop/
2. Click on the See download or language options link

3. The next page presents information about Power BI Desktop, its file size, and the system
requirements. Select your language and click on Download:
4. The next step is to select either the 32-bit or 64-bit version of the software. Installing the 64-bit
version will provide maximum performance benefits when analyzing data. Click on Next.

5. Power BI desktop begins downloading

6. When the download has been completed, open the file. This begins with the
Setup Wizard . Select your language and click on Next.
7. Follow the steps of the wizard to confirm the license terms, file path of the software, and complete
the installation by clicking on Finish.
Creating a Power BI account
You do not need a Power BI account to get started learning Power BI Desktop. However, you will
need a Power BI account to publish reports and use the Power BI service.
There are two ways to obtain a Power BI account:
● Sign up for a free, pro, or premium account as an individual. This requires a work or school email
account. E-mail accounts such as outlook.com and gmail.com are not supported.
● You may be assigned a license from an administrator at your organization.
Follow the following steps to sign up for a Power BI account:
1. Navigate to the following URL—powerbi.microsoft.com
2. Click either on the Start free or Try free link .
3. You may be taken to another page, where you need to click on the Try Power BI for free or Try
free link again
4. You will probably be recognized as already using a Microsoft account, at which point you can sign
in
5. If you are not recognized, you will need to enter a valid e-mail address to sign up. You will be
requested to review and accept the terms and conditions. It may take a short while to set up your
account. You should be taken to the Power BI service in a Web browser on completion.
Unit – 2
2 Marks
1. What are Filters in Power BI?

The term "Filter" is self-explanatory. Filters are mathematical and logical conditions applied to data
to filter out essential information in rows and columns. The following are the variety of filters
available in Power BI:
● Manual filters
● Auto filters
● Include/Exclude filters
● Drill-down filters
● Cross Drill filters
● Drillthrough filters
● Drillthrough filters
● URL filters–transient
● Pass-Through filters

2. Consider the below-given sample data:

Date Day Month


2021-02-01 1 2
2021-02-02 2 2
2021-02-03 3 2
2021-02-04 4 2
You need to create a calculated column to show the date in a format like this February 01, 2021.
Which of the following DAX expressions would you use?

Answer : “MMMM” is a user-defined format for date/time that displays the full month name as the
month. FORMAT([Date],”MMMM DD, YYYY”) is the right DAX expression.

3. What are the different join kinds available in power bi.

There are six different types of join available when performing a merge query. These are
known as Join Kinds and are used to specify how we would like to join the two queries.
The following is an explanation of the six different join types.
1. Left Outer: All rows from the first table and only those that match from the
second. This type of merge is often referred to as a typical lookup that you
may perform in Excel. This is the default and most used type of merge. It is
used to add columns to a table from another table. If no match is found in the
second table, a null value is returned.
2. Right Outer: Returns all rows from the second table regardless of whether
there is a match in the first. The rows where there is no match in the first table
will return null values. This merge is a reverse of the first join kind.
3. Full Outer: The merge will return all rows from both the first and second
tables matching the rows that it can. This ensures that all records from both
tables are returned.
4. Inner: This merge type only returns the matching rows (the records that
appear in both tables). Any rows without a match in the first or second tables
will not be returned.
5. Left Anti: The Anti merge types return the rows that appear in one table and
not the other. For the Left Anti, this means it returns all rows in the first table
that do not have a match in the second table. The columns returned for the
second table will all contain null values due to the nature of this merge.
6. Right Anti: The Right Anti is the reverse of the Left Anti join type. It will
return only the rows that appear in the second table and not the first. The
columns returned for the first table will all contain null values.

4. Converting ISO 8601 dates

Consider the Date of joined column in employee table. This column contains dates in the ISO
format. As there are no delimiters in the date format, the Whole Number data type was automatically
applied by Power Query. the values.
First, we change it to the Text data type. Then we change it to the Date data type as a separate step.
Click the change type button in the Date Joined header and click Text.
1. Click the change type button in the Date Joined header and click Date. A message appears asking if
you would like to change the existing changed type step or add a new changed type step for this
conversion.
2. Click Add new step. It is important that we preserve the previous change to the Text data type.

5. Calculations in power query

There are many calculations that you can perform in Power Query while writing little to no M
code (the language of Power Query). examples, including basic mathematical calculations,
date functions, inserting conditional columns, and rounding values. The Power Query UI
provides buttons to perform a variety of calculations on both the Transform and Add Column
tabs.
Figure shows the Transform tab on the Ribbon. The Number Column and Date and Time
Column groups provide easy access to many formulas. Using the formulas on the Transform
tab will change the values in the existing column.

Figure shows the formulas on the Add Column tab of the Ribbon. These formulas would not
change the existing column values but would add a new column with the formula results.

The same formulas are available here, as were seen on the Transform tab. There are additional
formulas at the start of the Ribbon, though, including Custom Column, Conditional Column,
and Index Column.
6. How Rounding values can be performed in power bi.

1. Click on the Value column to select it.


2. Click Transform | Rounding | Round
Three rounding calculations are available from the UI in Power Query—Round Up,
Round Down, and Round.
3. In the Round window (figure 6.31), type “2” for the number of Decimal Places.
Click OK:
The numbers in the Value column are rounded to two decimal places, and a Rounded
Off step is added to the query

7. Date functions—calculating age

Click on the DoB column to select it. Click Add Column | Date | Age. Calculate age from date of
birth. A new column named Age is added to the end of the table. It has returned the number of days
difference and a time value.This is not the result that we need, so we will add further transformation
steps.
● Click on the Age column to select it.
● Click Transform | Duration | Total Years
The Age column now shows the total years as a decimal value
To remove the decimal part of the result, we will round down to the nearest integer.
As we are calculating their age, it is important we round down at this step.
● Click on the Age column to select it.
● Click Transform | Rounding | Round Down

8. Explain about Unpivoting columns

Unpivoting columns convert header values into a single column and place all values
that belong to that header in a column alongside them. This is also commonly
referred to as flattening a table.

The header values in green are converted into a single column named Attributes.
The values in blue are placed in a single column named Values and sit beside the
header they belong to.
Unpivot columns option is available in Transform | Unpivot Columns. There are three options under
unpivot columns
1.unpivot columns
2. Unpivot Other Columns
3.unpivot only selected columns
10marks
1. Adding conditional columns
Imagine you have a sales dataset with the following columns:
● ProductID
● SalesAmount
● Region
● SalesDate
You want to create a new column called SalesCategory based on these conditions:
1. If SalesAmount is greater than $1000, label it as "High".
2. If SalesAmount is between $500 and $1000 (inclusive), label it as "Medium".
3. If SalesAmount is less than $500, label it as "Low".
4. If the Region is "North", append " (North)" to the label.
Steps to Add Conditional Columns Using GUI in Power BI
Step 1: Load Your Data
1. Open Power BI Desktop.
2. Load your dataset by clicking on "Get Data" and selecting your data source (e.g., Excel,
CSV).
Step 2: Open Power Query Editor
1. Once your data is loaded, click on the "Transform Data" button in the Home tab to open the
Power Query Editor.
Step 3: Add a Conditional Column
1. In the Power Query Editor, navigate to the Add Column tab in the ribbon.
2. Click on Conditional Column.
Step 4: Configure the Conditional Column
1. Name your new column: In the dialog box that appears, enter SalesCategory as the name of
the new column.
2. Set up your conditions:
○ First Condition:
■ In the "Column Name" dropdown, select SalesAmount.
■ Choose "is greater than" in the "Operator" dropdown.
■ Enter 1000 in the "Value" box.
■ In the "Output" box, enter High.
○ Add another condition:
■ Click on "Add Clause".
■ In the new row, select SalesAmount, choose "is greater than or equal to", and
enter 500.
■ In the "Output" box, enter Medium.
○ Add another condition:
■ Click on "Add Clause" again.
■ Select SalesAmount, choose "is less than", and enter 500.
■ In the "Output" box, enter Low.
○ Ensure that the conditions are set to be evaluated in the order they are listed.
3. Click OK to create the initial SalesCategory column.
Step 5: Modify the Column for Region
Now, you need to modify the column to append " (North)" for entries from the North region.
1. With the newly created SalesCategory column selected, go to the Add Column tab again.
2. Click on Custom Column.
3. In the Custom Column dialog:
○ Name your new column SalesCategoryFinal (or you can overwrite the previous one).
○ In the formula box, enter the following formula:
if [Region] = "North" then [SalesCategory] & " (North)" else [SalesCategory]
4.
5. Click OK to create this column.
Step 6: Close and Apply
1. Once you’ve created the conditional columns, click on Close & Apply in the Power Query
Editor.
2. The new SalesCategoryFinal column will now be available in your data model

2. Data Profiling in Power BI


Data profiling is the process of understanding more about the data. Below are the steps
for Data Profiling in power bi. In Power Query Editor, Under View tab in Data
Preview Section, we can see the following data profiling functionalities-
1. Monospaced
2. Show Whitespace
3. Column quality
4. Column distribution
5. Column profile

View Tab

1. Monospaced: Display data in a Monospaced Font.

change data font


2. Show Whitespace:
Show WhiteSpace and Newline Character.

3. Column quality:
we can easily see valid, Error and Empty percentage of data values associated with the Selected
table.

Column Quality

You can perform various transformations like Remove Errors, Remove Empty, Replace Errors, keep
duplicates, Remove Duplicates, etc. by clicking on the eclipses (…) or right-clicking on the visual.
Right, Click on the visual.

Remove the Empty Row in Address Column.

4. Column distribution:
In this section, we can easily see the inline value distribution histogram.
For example, distinct records, unique records.

column distribution
5. Column profile:
This is one of the most important features. As you can see for the selected column.
Column statistics which includes distribution measures like Count, error, empty, distinct, Unique,
Empty string, Min, Max.
The column profile shows the Column statistics and column distribution for the selected column.

Column Profile
Replace one value with another in the selected columns.

Replace Values

replaced Pune to Delhi

2. How to scrape and analyze website data with Power BI


Power BI connects to 115+ data sources. A webpage connector is very useful and enables data stored
on websites to be mashed up and analyzed. When several webpages in a given URL share the same
structure and content (e.g., a page for each year or category), the creation of a parameter for the URL
and a function to replicate the Power Query code can import all of the data into a single data-set. This
blog post will demonstrate how to do just that.
The data we are interested in is NFL game data over several years. This data is maintained at Pro
Football Reference https://www.pro-football-reference.com. Seasons are stored on separate pages as
shown in the following table:
2019 https://www.pro-football-reference.com/years/2019/games.html

2018 https://www.pro-football-reference.com/years/2018/games.html

2017 https://www.pro-football-reference.com/years/2017/games.html

On each page, we are interested in the data available in the “Week-by-Week Games” table.

Build the Data Transformation

Here are the steps to retrieve, transform, and analyze the data for the past 10 seasons. We will create
the transformation steps for one season then convert that script into a function that can be repeated
over any number of pages (years) of data on the website.
Open Power BI desktop and click “Transform Data” in the Home Ribbon. This opens Power Query
Editor, where we will define our data transformation. Create a parameter, pYear, to store the
year/season from which we wish to retrieve data. Click on “Manage Parameters” and click “New.”
We will store this as a text type since we will be plugging this into a URL.
Now, click “New Source,” and select “Web” and “Advanced” as shown below. We are breaking the
URL into 3 pieces, a first part (text), the year (parameter pYear), and the page name (text).
Click OK to preview the data and check the “Week-by-Week Games Table” to preview the data.

Click OK to import the data. At this point, we will need to do some data transformations before we
can analyze it. One of the first transformations to perform is to promote the first row as headers. Click
on “Use First Row as Headers” in the Home ribbon of Power Query Editor.
The first column, “Week” stores the season week number and playoffs round (e.g., WildCard,
Division, ConfChamp). It also has the repeating header, “Week” and there are some blank values. To
remove the blanks, click the arrow in the header, and select “Remove Empty.” Similarly, uncheck the
box next to “Week” and click OK.
One of the columns holds links to the boxscore for each game. This is not necessary for our dataset,
so let’s remove it by right-clicking on the column header and selecting “Remove.”
The table stores the winning team and the losing team in dedicated columns, with a column
containing the “@” symbol to denote if the game was played in the losing team’s stadium. This
column does not have a name, so rename it to “Location” (double-click the header and type
“Location”).
There is some other interesting information we can get from this dataset, like how often the home
team loses. To do this, click “Add Column” and “Conditional Column.” We will name this
“HomeTeamOutcome,” and the logic will be that if the “Location” column equals “@” then the home
team lost. See below.
Another useful column to have is an index column with a unique value for each row. This way, the
model can contain measures that count the number of distinct values of an ID field, as an example.
We will call this “GameID” and create it by clicking “Index Column” in the “Add Column Ribbon.”
We want our first value to be 1, not zero, so we select “From 1” in the drop-down. To rename the
resulting column named “Index,” double-click the column header and type “GameID.”

There is a lot more we could do to model this data, but for the purposes of the demonstration, we will
go ahead and convert this to a function and retrieve data for the last 10 seasons. We should rename
the table to “Season” by editing the Name in the Query Settings box.
Create the fnGetSeason Data Retrieval Function

To convert this into a function, right-click on the Season query in the Queries pane and select “Create
Function.”
Power BI detects that a parameter (pYear) is used in the function, and we can name the function
“fnGetSeason.”

Click OK and the function is created. Since we do not want the “Season” query to load in the report,
right-click and uncheck “Enable Load” in the dialog box.

We will need values to input into the function, so we will create a table with 10 rows, one for each of
the last 10 seasons. On the Home ribbon, click “Enter Data” and populate it as follows. Double click
on the column header to name the column “Year” and name the table “SeasonData.” Click OK and
there is now a table from which we will use our fnGetSeason function.
So we don’t have to do a text conversion inside the function, go ahead and change the type of column
for “Year” in SeasonData to Text. Right-click the column header, select “Change Type” and select
“Text.”
Load the Data

Now the fun part, calling the function and watching the data load!
While in the SeasonData table, activate the “Add Column” tab and select “Invoke Custom Function.”
For the pYear value, make sure “Column Name” is selected, and choose “Year” in the field
dropdown. Click OK and a new column will be created. This will be a table column, containing a
table in each cell.
By clicking the expand contents button in the column header , we can expand all of the contents, with
the Year column propagating next to the information about each game. Uncheck the “Use original
column name as prefix” option and click OK.
A preview of data will be displayed in the SeasonData table. You may notice that the field types are
of the “Any” category. We need to model those explicitly for the best results. The points (PtsW =
winning team points, PtsL = losing team points), number of yards (YdsW, YdsL), turnovers (TOW,
TOL), and GameID fields should be changed to Whole Number, with the remaining fields stored as
Text.
Load the data into the model by clicking “Close and Apply” from the Home Ribbon. This will load
data from the last 10 seasons into the SeasonData table. It is probably a good idea to save the
workbook at this point. Click the save button and save the file as “NFL Seasons.pbix.”
Create Columns and Measures

We might want to distinguish regular-season games from playoffs. To do this, remember we have a
field called “Week” with week number of the regular season and the round of playoffs. Since the
week number of the regular season is at most 2 digits and the playoffs are longer text values
(SuperBowl, WildCard, etc.), we can use the LEN function inside an IF statement to classify the
game as Regular Season or Playoffs. Right-click on the SeasonData table and select “New Column.”
In the formula editor, type the following:
GameType = if(len(SeasonData[Week]) < 3, "Regular Season", "Playoffs")

It is a good practice to create explicit measures in Power BI that define the calculations we want to
perform, rather than relying on aggregations of the columns as they are dropped into visuals. A
simple measure is the count of the number of games, accomplished by counting the number of
distinct GameID values. Right-click on SeasonData and select “New Measure.” Populate the formula
bar with the following text:
Games = DISTINCTCOUNT(SeasonData[GameID])

With this measure, we can create several visualizations, including counting the number of games
where the home team wins/loses by year and game type (see below for a graph showing the home
team wins and losses by year in the regular season since 2010). 2019 saw the lowest home team
winning percentage in the last 10 years.

Another example can be created showing the average score in the regular season. Create the
following two measures:
Avg Points Lose = AVERAGE(SeasonData[PtsL])
Avg Points Win = AVERAGE(SeasonData[PtsW])

Then, create a clustered column chart and filter the data where GameType = “Regular Season” as
shown below.
Unit 3
2 Marks
1. What are the two types of RLS in Power BI?

The two types of RLS in Power BI are Static RLS and Dynamic RLS. Static RLS is the
simpler of the two and requires a Power BI developer to manually define security-based logic.

2. Data Modeling and Visualization: Key Differences


The following table summarizes the differences between Data Modeling and Visualization:
Feature Data Modeling Data Visualization
Definitio Data Modeling refers to designing the Data Visualization involves presenting
n Entity-Relationship modeling for data in a visual context to show hidden
Database tables to establish the trends and patterns in data. Such trends
connections between tables. It also and patterns may not be explicit in text
involves designing the schema for Data data. Visualization makes data easy for
Warehouses. Thus, it shows how tables anyone to understand.
are connected in schema terms.
Techniq Data Modeling techniques include Data Visualization involves the use of
ues Entity-Relationship Diagrams (ERDs) graphs, charts, and tables to present data
to depict the way data has been stored visually. These visual tools show how the
in the Database. The ERDs show the different data attributes are related to each
types of relationships between the other.
different tables in the Database,
whether one-to-many, many-to-many,
etc. It also uses data dictionaries and
Unified Modeling Language (UML).
Used Data Modeling is used to ensure that Data Visualization is used to
For data is stored in a database and communicate information clearly and
represented accurately. It shows the efficiently to the users by presenting it
inherent structure of data by identifying using visual elements.
data identities, attributes, and the
relationship between the entities.
Benefits Facilitate faster access to data across Helps businesses understand their
the entire organization. Data Modeling customers, products, and processes better.
also makes it easy to establish the This is good for sound decision-making
correct structure of data and enforce and making predictions.
compliance standards.
Tools Common Data Modeling tools include Data Visualization is done using tools
Erwin Data Modeler, ER/Studio, such as Knowi, Tableau, Dygraphs,
DbSchema, ERBuilder, HeidiSQL, QlikView, DataHero, ZingCHhart, Domo,
Navicat Data Modeler, Toad Data and others. It can also be done in
Modeler, Archi, and others. programming languages such as Python
and R.
Perform Data Architects and Modelers. Data Engineers.
ed By
3. What is Data Modeling?

Data Modeling refers to the process of creating a visual representation of an entire information
system or some of its parts to communicate the relationships between data points and structures. The
purpose is to show the types of data stored in the system, the relationships among the data types, the
formats and attributes of the data, and how the data can be grouped and organized.
Data Models are normally created around business needs. Requirements and rules are defined upfront
via feedback obtained from business stakeholders so that they can be used for designing a new
system. The Data Modeling process begins with the collection of information about business
requirements from both stakeholders and end-users. The business requirements are then translated
into data structures for the formulation of a concrete Database design.

4. What is Data Visualization?

Data Visualization refers to the process of representing data and information graphically. By the use
of visual elements like graphs, charts, and maps, Data Visualization tools offer an accessible way to
view and understand trends and patterns in data.
Data Visualization helps organizations to analyze huge volumes of data and make data-driven
decisions. It also makes it easy for individuals and companies to understand data. Data Visualization
is very useful today as companies are generating and collecting huge data volumes. It can help them
to unmask hidden gems from data, which are good for growth.

5. Usage of Data Modeling


1. Designing Databases: Use data modeling when designing databases. It creates a visual
representation of data and establishes the relationships between different data elements.
2. Improving Data Consistency: Enforce business rules, regulatory compliances, and government
policies on data to improve the consistency, quality, and reliability of the data.
3. Increasing Efficiency of Data Processing: A well-designed data model can increase efficiency
in data processing, as it helps structure data to be easily accessed, managed, and updated.
4. Data Integration: Data modeling is critical when integrating disparate data sources, providing
a unified view of data elements and their relationships.

6.Usage of Data Visualization


1. Interpreting Complex Data Sets: Use data visualization to analyze complex datasets. It helps
to understand patterns, trends, and correlations in the data.
2. Presenting Data to Non-Technical Users: If you are presenting data to stakeholders or users
who may not have technical expertise, data visualization can be an effective tool. It simplifies
data interpretation by depicting it in a graphical format.
3. Making Informed Decisions: Use it to make data-driven decisions. Visualization provides a
clear, quick, and efficient way to understand and analyze data, enabling informed decision-
making.
4. Data Reporting: Data visualization is crucial for data reporting as it provides an appealing and
straightforward way to represent the results.
10-Marks
1.What Is Data Modeling?
Data modeling is like creating a blueprint of an information system, or parts of it, to illustrate the
connections between different data points and structures. It's all about identifying the kinds of data in
the system, their relations, formats, and features, and how they can be neatly grouped and organized.
This process is based on the business’ needs. The initial steps involve gathering business needs
directly from stakeholders and end-users. These needs, along with specific rules and requirements,
are then transformed into data structures, which pave the way for designing a solid database. In
today's world, data modeling is used everywhere, from banks to hospitals.
Types of Data Models
The three most common types of data models are relational, dimensional, and entity-relationship (E-
R). There are two advanced models—Object-Oriented Data Model and Dimensional Data Model.
Besides these, there are a few others, like hierarchical, network, object-oriented, and multi-value, but
they aren't as widely used.
The type of data model you choose sets the stage for how data is stored and organized and how you
can retrieve it.
1. Relational
Think of the relational model as an old-school but popular approach. It organizes data into tables with
rows and columns. Imagine you have data on mobile phones. Your basic elements are the 'type of
phones' and 'number of phones.' 'Type' is a dimension—like the description or location, and 'number'
is a measure used for math stuff like adding or averaging.
These tables are called 'relations,’ the columns are 'attributes,' the rows are 'tuples,' and the 'domain' is
the group of values a column can have. You can link tables using common data elements (called
keys). Like, you can relate phone types to their prices or suppliers.
2. Dimensional
This model adapts to how a business uses data. It's designed for faster online queries and is excellent
for data warehouses. Imagine you're keeping track of apple sales. The number of apples sold is a
'fact,' and the info around it (like apple type, price, and sale date) are 'dimensions.'
A fact table is the main table in a dimensional model. It's fast to get data for a specific activity, but
analyzing the data might need some extra work since it doesn't link everything together like the
relational model.
3. Entity-Relationship (E-R)
E-R models are like visual diagrams showing how different business data are connected. They've got
boxes for activities or 'entities' and lines, which show how these boxes are linked, or the
'relationships.' This diagram helps in building a relational database. For example, every row might
represent a phone, and the fields in that row have attributes like type and color. Key data elements tie
tables together.
4. Object-Oriented Data Model
This more advanced model uses objects as the fundamental structure for defining and describing data,
as opposed to the entity-relationship model, which represents data in terms of entities and their
relationships.
Objects mirror real-world entities and comprise various attributes. For instance, as an object, a
customer would have attributes like name, address, phone number, and email address. In an entity-
relationship model, these attributes are stored in different tables to establish relationships between
these tables.
5. Dimensional Data Model
Dimensional data models are the backbone of business intelligence (BI) and online analytical
processing (OLAP) systems. Primarily used in data warehouses for maintaining historical
transactional data, you can also utilize these models for smaller datasets.
The dimensional data models include several structures, like fact tables, dimension tables, and lookup
tables, which together form the foundation for creating enterprise data warehouses and online
transaction processing systems.
The principal goal of a dimensional model is to facilitate rapid responses to business-related queries
about forecasts, trends, and more. By providing an organized approach for business intelligence
reporting, dimensional modeling enhances cross-departmental information sharing, fostering efficient
collaboration and decision-making within an organization.
2. Role of Data Modeling in Data Analytics
Data modeling is key for effective data analytics. It ensures that data is structured, organized, and
understood, making extracting meaningful insights from the data easier. For example, data modeling
helps in:
1. Designing Databases: Data modeling helps create the structure of databases, including the
development of schemas, which outline the organization of data in a database, the types of
data you can store, and how these different data elements are related. This forms the
foundation for efficient data storage and retrieval, essential for data analytics.
2. Understanding Data Relationships: Data modeling involves defining relationships between
various data entities. Understanding these relationships is key in data analytics, as it can
reveal patterns and dependencies that might otherwise be overlooked.
3. Integrating Data: Data modeling aids in integrating data from various sources by ensuring you
can merge and cohesively analyze data from different databases. This is especially important
when dealing with large data sets or conducting complex analyses involving multiple
databases.
4. Predictive Modeling: Data models are often used in predictive modeling, a key aspect of data
analytics. Use these models to predict future trends, identify risks, and find opportunities
based on historical data and trends.
5. Ensuring Data Consistency: By defining the rules for data, data modeling can help ensure the
quality and consistency of data. It helps prevent errors in data analysis and can make the
results of data analysis more reliable and accurate.
Benefits of Data Modeling
Data modeling plays an integral role in organizing and structuring data. It allows for a visual
representation of data and facilitates better understanding and utilization of this data. Here are five
key benefits of data modeling:
1. Ensures Consistency
Data modeling enforces standards ensuring data consistency across the organization so everyone uses
and interprets the data in the same way, reducing confusion and misinterpretation when conducting
analysis.
2. Facilitates Data Integration
Data modeling is crucial when integrating data from various sources. It helps map relationships
between different data types and sources, ensuring data can be accurately combined and analyzed
collectively.
3. Improves Data Quality
Through data modeling, inconsistencies, duplications, and errors can be identified and addressed
early in the data preparation process. It leads to higher-quality data, resulting in more accurate and
reliable analytics.

3. How Data Modeling Supports the Creation of Meaningful Visualizations


Data modeling plays a pivotal role in supporting the creation of meaningful visualizations. Here's
how:
1. Structured and Organized Data: A well-structured data model organizes data coherently and
logically. This structure facilitates the extraction and presentation of data in various
visualization formats, making it easier to interpret and understand.
2. Ensuring Data Integrity: By establishing relationships between different data elements, data
modeling helps to maintain data integrity. This integrity ensures the accuracy and consistency
of data visualizations, as the visualizations are based on trustworthy and reliable data.
3. Improves Efficiency: A good data model improves data processing efficiency, making it faster
and easier to retrieve the data needed for visualizations. It can be particularly beneficial when
dealing with large volumes of data or complex data sets.
4. Facilitates Data Analysis: Data modeling can facilitate more in-depth data analysis by
providing a clear, detailed view of how data is related and organized.
5. Supports Interactivity: In many cases, modern data visualization tools require data to be
structured in a certain way to support interactive features. A well-designed data model ensures
the data is organized so you can use effectively with these tools.
6. Better Understanding of Data Relationships: Data modeling helps understand relationships
between different entities and attributes and creates visualizations highlighting these
relationships, providing deeper insights.

4. How to create a new visualization?


Download the Retail Analysis Sample PBIX file.
In Power BI Desktop, select File > Open report.
Browse to and select the Retail Analysis Sample PBIX file, and then select Open.
The Retail Analysis Sample PBIX file opens in report view.
At the bottom, select the green plus symbol to add a new page to the report.

Add visualizations to the report


You can create a visualization by selecting a field in the Data pane. Power BI uses the type of field
that you select to determine which visualization type to use. You can change the visualization type by
selecting a different icon in the Visualizations pane. Keep in mind that not all visualizations can
display all data types. For example, geographic data doesn't display well in a funnel chart or line
chart.
Add an area chart that compares this year's sales to last year's sales
1. In the Data pane, expand Sales and select the Last Year Sales checkbox. Then expand This
Year Sales and select the Value checkbox. Power BI creates a column chart. This chart is
interesting, and you want to look closer. What do the sales look like by month?

2. In the Data pane, expand Time and drag FiscalMonth to the X-axis area of
the Visualizations pane. You can now see comparisons by month:
3. In this step, you change the visualization type. There are many visualization types to choose
from. To decide which type to use, see descriptions of each, tips for best practices, and tutorials.
To use an area chart, in the Visualizations pane, select the Area chart button:

4. Sort the visualization by selecting More options (...) at the top of the chart and then
selecting Sort axis > FiscalMonth:
5. Resize the visualization by selecting it and dragging one of the frame handles. Make it wide
enough to eliminate the scrollbar but small enough to leave room for another visualization:

6. Save the report.

You might also like