Data Visualization With Power BI
Data Visualization With Power BI
com/tutorial/data-
visualisation-powerbi
Data Visualization with Power BI
Learn how to analyze and display data using Power BI and make better, more data-driven
decisions.
Apr 2019 · 16 min read
Contents
1. Overview of Power BI
3. Power BI Desktop
4. Getting Started
5. Transforming Data
6. Reports
7. Dashboard
10. Conclusion
Share
Our goal as Data Analysts is to arrange the insights of our data in such a way that everybody
who sees them is able to understand their implications and acts on them accordingly.
Power BI is a cloud-based business analytics service from Microsoft that enables anyone to
visualize and analyze data, with better speed and efficiency. It is a powerful as well as a flexible
BI tool for connecting with and analyzing a wide variety of data. Many businesses even consider
it indispensable for data-science-related work. Power BI’s ease of use comes from the fact that it
has a drag and drop interface. This feature helps to perform tasks like sorting, comparing and
analyzing, very easily and fast. Power BI is also compatible with multiple sources, including
Excel, SQL Server, and cloud-based data repositories which makes it an excellent choice for
Data Scientists.
1. Overview of Power BI
Overview
Power BI gives the ability to analyze and explore data on-premise as well as in the cloud. Power
BI provides the ability to collaborate and share customized dashboards and interactive reports
across colleagues and organizations, easily and securely.
Source
Power BI consists of various components which are available in the market separately and can be
used exclusively.
Content Source
Choosing which component to work with depends mainly on the project or a team. We, however,
will be working with Power BI desktop since this is a component primarily used for Business
reports generation and desktop creation. Also, all the other works typically begin with Power BI
desktop, where the report creation takes place.
Introduction to Power BI
For a great hands-on introduction on how to navigate the Power BI platform, take DataCamp's
course, Introduction to Power BI.
2. Advantages of using Power BI
Power BI provides certain benefits which make it superior to the existing analytical tools:
3. Power BI Desktop
Power BI is a free application that can be downloaded and installed on the system. It can be
connected to multiple data sources. Usually, an analysis work begins in Power BI Desktop
where report creation takes place. The report is then published to Power BI service from where
it can be shared to the Power BI Mobile apps so that people can view the reports even on
mobiles.
Source: https://docs.microsoft.com/en-us/learn/modules/get-started-with-power-bi/2-using-
power-bi
Installation
Power BI only runs on Windows Machines. Mac users could spin up a Windows VM in Azure
and load Power BI onto that or use Turbo.net, which can stream Power BI to the Mac directly
from the cloud.
As an app from the Microsoft store and just sign in to get started. This is the online
version of the tool.
Download the software locally and then install it. Make sure you read all the installation
instructions.
Depending upon the choice of product, download the software on to the computer. After
accepting the license agreement, verify the installation by clicking the Power BI Icon/App. If the
following screen appears, you are good to go.
4. Getting Started
Let us now get an idea about working with Power BI Desktop. In this section, we shall explore it
a bit to get accustomed to its interface.
Power BI Workspace
The image below highlights the major components of the workspace of Power BI.
Basic Views
Report View: This is the main view where the Dashboard is created.
Data View: The data view gives a preview of the entire data.
Relationship View: The relationship view displays the relationship between various
objects.
Connecting to a Data Source
Power BI can be connected to several data sources. The Get Data icon displays all the possible
available options from where data can be imported into Power BI.
Let’s look at a few of the most commonly used data sources:
Excel data
Let’s connect to an Excel data source. The workbooks consist of some fake financial data.
Download the file from here. Power BI Desktop loads the workbook and reads its contents, and
shows you the data in the file using the Navigator window.
You can also use the data from the web. Here is a dataset which presents the best and the worst
states for retirement in the U.S.
link: https://www.bankrate.com/retirement/best-and-worst-states-for-retirement/
Simply select Web as an option in Get Data and enter the name of the url.
Try experimenting with other data sources too.
5. Transforming Data
After the data has been loaded, it becomes visible under the Fields Tab. From here, we can
modify our datasets with the help of Query Editor. Query editor can be used for modifying
datasets irrespective of their data source. We can do manipulations like renaming a dataset,
removing a single or multiple columns, etc. in the query editor. The Query Editor can be
accessed by clicking the Edit Queries button on the Home Ribbon.
Using the same Financial data, that we used above, let’s shape data to meet our needs. Let’s
create a custom column called New Manufacturing Price, which is equal to:
([manufacturing Price])*3
OpenAI
Changing Column Data Types
The data types of the columns can also be changed easily. The Units Sold column has a
floating point data type which can be adjusted to a whole number.
Removing Columns
Removing columns is also easy. Simply select the column to be selected and choose the Remove
Columns option, as shown in the following figure. Let’s get rid of the Discount column as it is
adding no value to our dataset.
Similarly, there are other multitudes of functions that can be carried out like removing and
adding rows, transpose, pivot and split which can be easily achieved through the query editor.
Note that all the steps that you undertake to transform your data also appears in the Query
Settings panel.
6. Reports
Reports are a collection of visualizations that can be created on one or more pages. These
visualizations are usually related to one another.
7. Dashboard
A dashboard is a collection of several views, enabling one to compare a variety of data
simultaneously. Whereas the report can encompass various pages, a Dashboard is a single page
interface.
Creating a Dashboard
Once we have the dataset ready with all the manipulations done, we can proceed for the
Dashboard creation process. A Power BI dashboard, also known as canvas, consists of many
visualizations on a single page which helps to tell a story. These visualizations called tiles are
pinned to the dashboard from the reports.
Let’s now try to understand what insights we can get using superstore data set:-
Sales by Country
Sales and Profit by Segment
Sales & Profit by Month
Sales by Product
Profit by Discount Band
The Dashboard created is interactive which means a change in one tile affects the other.
8. Power BI’s integration with R & Python
Apart from the various visualization advantages that Power BI offers, it also has an amazing out
of the box connection capabilities. Power BI can easily integrate with languages like Python, R,
and even with DBMS like SQL. This offers increased advantages in terms of functionalities and
comes in handy for Data Scientists who are used to working in Python or R. They can directly
import the R and Python scripts in the workspace and take advantage of its visualizations which
are far more superior than that of these languages.
In this section we shall learn how to work with Python and R scripts in R. For learning about
SQL’s integration with Power BI, here is a detailed article on that:
Power BI & R
R is a popular statistical language used to perform sophisticated analysis and predictive analytics,
such as linear and nonlinear modeling, statistical tests, time-series analysis, classification,
clustering, etc. Using Power BI in conjunction with R gives the users access to a rich, ever-
expanding collection of statistical analysis and data mining libraries to help them gain deeper
insights from their data.
Pre-requisites
Make sure you have the following installed and running on your local systems:
R
A separate R integrated development environment (IDE) like R Studio.
Verify that R and R studio are installed on your system. Launch the Power BI and go to Options
and Settings -> Options
Under Options, go to the R Scripting Tab and make sure you can see the correct R version.
Using R Scripts within Power BI
Working with R Scripts in Power BI is an excellent resource on this topic. Below is an overview
from the same source.
There may be times when you don’t want to import an entire dataset but a portion of it. You can
write an R script to only select specific columns or rows from the entire dataset to be loaded into
Power BI.
For this demonstration, we will be working with the well known Iris dataset that is included with
the CRAN distribution.
Datasets can also be imported from files. Here is an example which shows how to load a CSV
file into the workspace with the following script. Download the file from here.
install.packages("dplyr")
install.packages("data.table")
install.packages("ggplot2")
OpenAI
Now, use the following R script to import the Iris data. We will get a new dataset called
iris_mean which contains the mean for each of the four measures, grouped according to the
values in the Species column (Source: Power BI Introduction).
library(dplyr)
iris_mean <- summarize(group_by(iris, Species),
slength = mean(Sepal.Length), swidth = mean(Sepal.Width),
plength = mean(Petal.Length), pwidth = mean(Petal.Width))
OpenAI
R scripts come in handy when we want to manipulate data that is already imported into the
workspace. Let’s say we want to apply the summarize and groupby functions after the entire
data has been imported. This can be achieved by running R Script in the Query Editor as follows:
3. R scripts for Creating Visualizations
With the help of R scripts, you can create visualizations in Power BI. Simply type in the script
and load in the necessary libraries, and you get visualizations similar to the ones in any R IDE.
Let’s go through the steps:
library(ggplot2)
ggplot(data=dataset, aes(x=PetalWidthCm, y=PetalLengthCm)) +
geom_point(aes(color=Species), size=2) +
ggtitle("Petal Widths and Lengths") +
labs(x="Petal Width", y="Petal Length") +
theme_bw() +
theme(title=element_text(size=15, color="blue3"))
OpenAI
Python is a widely used general-purpose programming language, and a large number of Python
libraries are available to perform statistical analysis, predictive modeling using machine learning
algorithms.
Microsoft recently made it possible to integrate Python scripts within PowerBI which enables
running Python scripts and obtaining Python visuals within Power BI. Let’s look at the steps
needed to do the same. But before that there are few pre-requisites:
Under Options, go to the Preview Features Tab and enable ‘Python Support’.
Restart Power BI and you get the Python icon both in visualization as well as in the Transform
tab.
There are multiple ways of running Python Scripts in Power BI.
Steps:
To run your Python Script, select Get Data > More>Other > Python script as shown
below.
Now, simply paste your Python script here in the window that opens. Select OK to run the script
which and then imports the resulting datasets into the Power BI Desktop workspace.
2. Creating Visualizations using Python
Import the dataset into the workspace. Going with the same Financial dataset, which
pertains to Financials of a hypothetical company.
Click on the ‘Python Visuals’ in the visualization Tab and a placeholder Python visual
image appears on the canvas and a Python script editor at the bottom.
Select the fields that you want to include in the script. Let’s select Sales and Profit.
The selected fields appear under the Values Tab, and the scripts also appears in the
Python script editor.
The script creates a pandas dataframe named dataset with the selected columns. You
can now write your script here or make changes in the existing one. Let’s paste the
following code which imports matplotlib and creates a plot.
plt.show()
OpenAI
The Dashboard with all the Python visualizations will finally appear like this.
Python Dashboard
You can save your files as Power BI templates. The visualizations can also be exported as PDF
files.
Publishing
Data is only useful when it can be shared among people or organization. The generated
Dashboard or reports can also be shared by publishing it to the Power BI Service. We can then
use the Power BI Apps to view or interact with the Dashboards/Reports.
10. Conclusion
That’s all we need to know to create a good visualization in PowerBI although, one might find
doing a lot more revising in each stage than we did here. So with experimentation and practice,
Power BI becomes a lot more familiar and will unleash amazing features to help us analyze and
present data
by Lauren Ballejos, IT Editorial Expertreviewed by Stan Hunter, Technical Marketing Engineer
IT Ops
Informed decision-making relies heavily on the ability to interpret and derive insights from data.
With the increasing volume and complexity of data in today’s business environment, having a
tool that can transform raw data into meaningful visualizations is crucial. Learn how to use
Power BI – a game-changer in the world of data analysis and reporting.
Microsoft Power BI is a business analytics tool that allows users to visualize data and share
insights across an organization. Whether you’re an analyst, business user, or IT professional,
Power BI provides a unified platform for creating interactive reports and dashboards. It connects
to a wide range of data sources, transforms raw data into actionable information, and facilitates
data-driven decision-making.
This guide is designed for those new to Power BI, covering everything from installation to
creating reports and interactive dashboards. By the end of this tutorial, readers will have gained
an understanding of Power BI interface navigation, importing and managing data, building
reports, and utilizing Power BI for effective data analytics.
Getting started with Power BI
Installing Power BI
To begin your Power BI journey, start by installing the Power BI Desktop application. It’s a free,
standalone application that allows you to create reports and dashboards. Search via your
preferred search engine, download the latest version from Microsoft, follow the straightforward
installation process, and you’ll have the tool ready to use.
Power BI basics
Understanding the Power BI workspace
Grasping the Power BI workspace is fundamental. Learn about datasets, reports, and dashboards.
Understand how they interconnect and how changes in one area affect others. Gain insights into
the relationship between the Power BI Desktop application and the Power BI service.
1. Select “Get Data” from the Home tab, then choose the type of data source (e.g., Excel, CSV,
Database) and provide connection details.
2. Transform and load data by using the Power Query Editor to clean, transform, and shape the
data. Click “Close & Apply” to load the data into Power BI.
Datasets in Power BI represent your data source. They can be imported or created within Power
BI.
1. Create a dataset, either by importing data or defining a new dataset, by using the Power BI
Desktop interface.
2. If your dataset includes multiple tables, create relationships between them in the Power BI data
model.
3. Rename fields as required, set data types, and manage properties using the Fields pane.
1. In Power BI Desktop, click on the “Relationships” view to understand how tables are connected.
2. Review the tables and fields in the data model to understand their structure.
3. Utilize DAX (Data Analysis Expressions) to create calculated columns based on existing data.
4. Switch to the “Data” view to see a tabular representation of your data model.
Choose visualizations
1. Click on the “Report” tab at the bottom to enter the report view.
2. In the Fields pane, drag and drop fields onto the report canvas.
3. Explore the Visualizations pane on the right.
4. Select the type of visualization (e.g., bar chart, line chart) based on your data.
1. In the “View” tab, select “Themes” to apply predefined styles or create custom themes.
2. Click on a visual to select it, and use the format pane on the right to customize colors, fonts, and
other visual elements.
3. Customize the report background and add borders if necessary.
Power BI includes a number of advanced features that can be used to enhance your reports,
including:
Advanced analytics: In the Visualizations pane, click on the ellipsis (…) and select “Analytics.”
Enable features such as trendlines, reference lines, and clustering.
Forecasting: Click on a time-series visualization. In the Analytics pane, turn on the forecasting
option to predict future trends.
Statistical measures: Utilize statistical measures such as median, variance, or percentiles in the
Analytics pane.
Insights: Use the “Explain the Increase” or “Find where this distribution differs” features for
deeper insights.
In Power BI, open the report containing the visuals you want to add to the dashboard.
Pin visuals by selecting a visual on the report, click on “Pin Live Page” or “Pin to Dashboard”, and
choose the dashboard where you want to pin the visual.
Arrange and resize tiles by dragging and dropping them into your desired layout.
Pin visuals from multiple reports onto the same dashboard for a consolidated view.
Sharing and collaboration are where Power BI dashboards truly bring analytics to life. Sharing a
dashboard is as simple as clicking ‘Share’ from within a dashboard. Permissions can be set for
specific users and groups to determine whether recipients can read-only or edit the dashboard.
Publishing a report or dashboard to the Power BI service makes it accessible to those you have
granted permission to, who can access it via a shared link. Users can leave comments against
visuals, enhancing collaboration.
Launch Power Query: Launch Power BI Desktop on your computer, and select the “Home” tab
to access Power Query. Choose “Transform Data” to enter the Power Query Editor.
Connect to data sources: Within the Power Query Editor, navigate to the “Home” tab and select
“Get Data”. Select the desired data source from the list (e.g., Excel, SQL Server, Web), and enter
connection details, such as server addresses or file paths. Click “OK” or “Connect” to load the
selected data into Power Query.
Shape the data: Review the loaded data within the Power Query Editor, then clean, filter, and
transform the data as required. Use the “Transform” and “Add Column” tabs to apply
transformations and merge or append multiple queries to consolidate data.
Load data into Power BI: Return to the “Home” tab in Power Query Editor, and select “Close &
Apply” to load the transformed data into Power BI.
Synchronize changes: Changes made in Power Query are automatically synchronized with
Power BI, ensuring a consistent user experience.
Test and validate: Navigate to Power BI Desktop and preview the integrated data, using the
integrated data to create insightful reports and visualizations.
Experiment with diverse data sources and transformations to unlock the full potential of the
dynamic integration between Power BI and Power Query.
Microsoft Power BI forum: The official community forum hosted by Microsoft for Power BI users.
It includes various categories such as Desktop, Service, Mobile, and more. Users can ask
questions, share ideas, and collaborate with other Power BI enthusiasts. Microsoft experts and
MVPs often participate in discussions.
Microsoft Power BI blog: The official blog of Power BI by Microsoft. Regularly updated with
official announcements, feature highlights, and case studies. Ideal for staying informed about
the latest in the Power BI ecosystem.
Power BI Tips: A community-driven website with a focus on Power BI tips, tricks, and best
practices. Users can contribute their tips, access tutorials, and stay updated on the latest Power
BI news.
Build on this introductory information by experimenting with datasets and visualizations and
creating informative reports and dashboards. The more familiar you become with the capabilities
of Power BI, the more adept you’ll become in transforming data into actionable insights.
Power BI is a versatile and powerful tool, providing powerful analytics features and seamless
integration with other Microsoft products with an intuitive and accessible user interface.
Mastering Power BI puts you at the forefront of modern data analysis and reporting workflows,
empowering your organization with the data analytics and visualizations that inform decision-
making and success