Ai PL-300
Ai PL-300
Rajajinagar
Introduction
With data and information as the most strategic asset of a business, the underlying challenge that
organizations have today is understanding and using their data to positively affect change within
the business. Businesses continue to struggle to use their data in a meaningful and productive
way, which impacts their ability to act.
A retail business should be able to use their vast amounts of data and information in such a way
that impacts the business, including:
• Tracking inventory
• Identifying purchase habits
• Detecting user trends and patterns
• Recommending purchases
• Determining price optimizations
• Identifying and stopping fraud
Additionally, you might be looking for daily/monthly sale patterns. Common data segments that
you might want to examine include day-over-day, week-over-week, and month-over-month so
that you can compare how sales have been to where they were in the same week last year, for
example.
The key to unlocking this data is being able to tell a story with it. In today's highly competitive and
fast-paced business world, crafting reports that tell that story is what helps business leaders take
action on the data. Business decision makers depend on an accurate story to drive better business
decisions. The faster a business can make precise decisions, the more competitive they will be and
the better advantage they will have. Without the story, it is difficult to understand what the data is
trying to tell you.
However, having data alone is not enough. You need to be able to act on the data to affect
change within the business. That action could involve reallocating resources within the business to
accommodate a need, or it could be identifying a failing campaign and knowing when to change
course. These situations are where telling a story with your data is important.
The underlying challenge that businesses face today is understanding and using their data in such
a way that impacts their business and ultimately their bottom line. You need to be able to look at
the data and facilitate trusted business decisions. Then, you need the ability to look at metrics and
clearly understand the meaning behind those metrics.
1
This requirement might seem daunting, but it's a task that you can accomplish. Your first step is to
partner with data experts within your organization, such as data engineers and data scientists, to
help get the data that you need to tell that story. Ask these experts to participate in that data
journey with you.
Data analysis exists to help overcome these challenges and pain points, ultimately assisting
businesses in finding insights and uncovering hidden value in troves of data through storytelling.
As you read on, you will learn how to use and apply analytical skills to go beyond a single report
and help impact and influence your organization by telling stories with data and driving that data
culture.
Data analysis is the process of identifying, cleaning, transforming, and modeling data to discover
meaningful and useful information. The data is then crafted into a story through reports for
analysis to support the critical decision-making process.
Data-driven businesses make decisions based on the story that their data tells, and in today's
data-driven world, data is not being used to its full potential, a challenge that most businesses
face. Data analysis is, and should be, a critical aspect of all organizations to help determine the
impact to their business, including evaluating customer sentiment, performing market and product
research, and identifying trends or other data insights.
While the process of data analysis focuses on the tasks of cleaning, modeling, and visualizing data,
the concept of data analysis and its importance to business should not be understated.
To analyze data, core components of analytics are divided into the following categories:
• Descriptive
• Diagnostic
• Predictive
• Prescriptive
• Cognitive
2
Descriptive analytics
Descriptive analytics help answer questions about what has happened based on historical data.
Descriptive analytics techniques summarize large datasets to describe outcomes to stakeholders.
By developing key performance indicators (KPIs), these strategies can help track the success or
failure of key objectives. Metrics such as return on investment (ROI) are used in many industries,
and specialized metrics are developed to track performance in specific industries.
Diagnostic analytics
Diagnostic analytics help answer questions about why events happened. Diagnostic analytics
techniques supplement basic descriptive analytics, and they use the findings from descriptive
analytics to discover the cause of these events. Then, performance indicators are further
investigated to discover why these events improved or became worse. Generally, this process
occurs in three steps:
Predictive analytics
Predictive analytics help answer questions about what will happen in the future. Predictive
analytics techniques use historical data to identify trends and determine if they're likely to recur.
Predictive analytical tools provide valuable insight into what might happen in the future.
Techniques include a variety of statistical and machine learning techniques such as neural
networks, decision trees, and regression.
Prescriptive analytics
Prescriptive analytics help answer questions about which actions should be taken to achieve a goal
or target. By using insights from prescriptive analytics, organizations can make data-driven
decisions. This technique allows businesses to make informed decisions in the face of uncertainty.
Prescriptive analytics techniques rely on machine learning as one of the strategies to find patterns
in large datasets. By analyzing past decisions and events, organizations can estimate the likelihood
of different outcomes.
3
Cognitive analytics
Cognitive analytics attempt to draw inferences from existing data and patterns, derive conclusions
based on existing knowledge bases, and then add these findings back into the knowledge base for
future inferences, a self-learning feedback loop. Cognitive analytics help you learn what might
happen if circumstances change and determine how you might handle these situations.
Inferences aren't structured queries based on a rules database; rather, they're unstructured
hypotheses that are gathered from several sources and expressed with varying degrees of
confidence. Effective cognitive analytics depend on machine learning algorithms, and will use
several natural language processing concepts to make sense of previously untapped data sources,
such as call center conversation logs and product reviews.
Example
By enabling reporting and data visualizations, a retail business uses descriptive analytics to look at
patterns of purchases from previous years to determine what products might be popular next
year. The company might also look at supporting data to understand why a particular product was
popular and if that trend is continuing, which will help them determine whether to continue
stocking that product.
A business might determine that a certain product was popular over a specific timeframe. Then,
they can use this analysis to determine whether certain marketing efforts or online social activities
contributed to the sales increase.
An underlying facet of data analysis is that a business needs to trust its data. As a practice, the
data analysis process will capture data from trusted sources and shape it into something that is
consumable, meaningful, and easily understood to help with the decision-making process. Data
analysis enables businesses to fully understand their data through data-driven processes and
decisions, allowing them to be confident in their decisions.
As the amount of data grows, so does the need for data analysts. A data analyst knows how to
organize information and distill it into something relevant and comprehensible. A data analyst
knows how to gather the right data and what to do with it, in other words, making sense of the
data in your data overload.
Roles in data
The following sections highlight these different roles in data and the specific responsibility in the
overall spectrum of data discovery and understanding:
• Business analyst
• Data analyst
4
• Data engineer
• Data scientist
• Database administrator
Business analyst
While some similarities exist between a data analyst and business analyst, the key differentiator
between the two roles is what they do with data. A business analyst is closer to the business and is
a specialist in interpreting the data that comes from the visualization. Often, the roles of data
analyst and business analyst could be the responsibility of a single person.
Data analyst
A data analyst enables businesses to maximize the value of their data assets through visualization
and reporting tools such as Microsoft Power BI. Data analysts are responsible for profiling,
cleaning, and transforming data. Their responsibilities also include designing and building scalable
and effective data models, and enabling and implementing the advanced analytics capabilities into
reports for analysis. A data analyst works with the pertinent stakeholders to identify appropriate
and necessary data and reporting requirements, and then they are tasked with turning raw data
into relevant and meaningful insights.
A data analyst is also responsible for the management of Power BI assets, including reports,
dashboards, workspaces, and the underlying datasets that are used in the reports. They are tasked
with implementing and configuring proper security procedures, in conjunction with stakeholder
requirements, to ensure the safekeeping of all Power BI assets and their data.
Data analysts work with data engineers to determine and locate appropriate data sources that
meet stakeholder requirements. Additionally, data analysts work with the data engineer and
database administrator to ensure that the analyst has proper access to the needed data sources.
The data analyst also works with the data engineer to identify new processes or improve existing
processes for collecting data for analysis.
Data engineer
Data engineers provision and set up data platform technologies that are on-premises and in the
cloud. They manage and secure the flow of structured and unstructured data from multiple
sources. The data platforms that they use can include relational databases, nonrelational
databases, data streams, and file stores. Data engineers also ensure that data services securely and
seamlessly integrate across data platforms.
Primary responsibilities of data engineers include the use of on-premises and cloud data services
and tools to ingest, egress, and transform data from multiple sources. Data engineers collaborate
5
with business stakeholders to identify and meet data requirements. They design and implement
solutions.
While some alignment might exist in the tasks and responsibilities of a data engineer and a
database administrator, a data engineer's scope of work goes well beyond looking after a
database and the server where it's hosted and likely doesn't include the overall operational data
management.
A data engineer adds tremendous value to business intelligence and data science projects. When
the data engineer brings data together, often described as data wrangling, projects move faster
because data scientists can focus on their own areas of work.
As a data analyst, you would work closely with a data engineer in making sure that you can access
the variety of structured and unstructured data sources because they will support you in
optimizing data models, which are typically served from a modern data warehouse or data lake.
Both database administrators and business intelligence professionals can transition to a data
engineer role; they need to learn the tools and technology that are used to process large amounts
of data.
Data scientist
Data scientists perform advanced analytics to extract value from data. Their work can vary from
descriptive analytics to predictive analytics. Descriptive analytics evaluate data through a process
known as exploratory data analysis (EDA). Predictive analytics are used in machine learning to
apply modeling techniques that can detect anomalies or patterns. These analytics are important
parts of forecast models.
Descriptive and predictive analytics are only partial aspects of data scientists' work. Some data
scientists might work in the realm of deep learning, performing iterative experiments to solve a
complex data problem by using customized algorithms.
Anecdotal evidence suggests that most of the work in a data science project is spent on data
wrangling and feature engineering. Data scientists can speed up the experimentation process
when data engineers use their skills to successfully wrangle data.
On the surface, it might seem that a data scientist and data analyst are far apart in the work that
they do, but this conjecture is untrue. A data scientist looks at data to determine the questions
that need answers and will often devise a hypothesis or an experiment and then turn to the data
analyst to assist with the data visualization and reporting.
6
Database administrator
A database administrator implements and manages the operational aspects of cloud-native and
hybrid data platform solutions that are built on Microsoft Azure data services and Microsoft SQL
Server. A database administrator is responsible for the overall availability and consistent
performance and optimizations of the database solutions. They work with stakeholders to identify
and implement the policies, tools, and processes for data backup and recovery plans.
The role of a database administrator is different from the role of a data engineer. A database
administrator monitors and manages the overall health of a database and the hardware that it
resides on, whereas a data engineer is involved in the process of data wrangling, in other words,
ingesting, transforming, validating, and cleaning data to meet business needs and requirements.
The database administrator is also responsible for managing the overall security of the data,
granting and restricting user access and privileges to the data as determined by business needs
and requirements.
The following figure shows the five key areas that you'll engage in during the data analysis
process.
7
Prepare
As a data analyst, you'll likely divide most of your time between the prepare and model tasks.
Deficient or incorrect data can have a major impact that results in invalid reports, a loss of trust,
and a negative effect on business decisions, which can lead to loss in revenue, a negative business
impact, and more.
Before a report can be created, data must be prepared. Data preparation is the process of
profiling, cleaning, and transforming your data to get it ready to model and visualize.
Data preparation is the process of taking raw data and turning it into information that is trusted
and understandable. It involves, among other things, ensuring the integrity of the data, correcting
wrong or inaccurate data, identifying missing data, converting data from one structure to another
or from one type to another, or even a task as simple as making data more readable.
Data preparation also involves understanding how you're going to get and connect to the data
and the performance implications of the decisions. When connecting to data, you need to make
decisions to ensure that models and reports meet, and perform to, acknowledged requirements
and expectations.
Privacy and security assurances are also important. These assurances can include anonymizing
data to avoid oversharing or preventing people from seeing personally identifiable information
when it isn't needed. Alternatively, helping to ensure privacy and security can involve removing
that data completely if it doesn't fit in with the story that you're trying to shape.
8
Data preparation can often be a lengthy process. Data analysts follow a series of steps and
methods to prepare data for placement into a proper context and state that eliminate poor data
quality and allow it to be turned into valuable insights.
Model
When the data is in a proper state, it's ready to be modeled. Data modeling is the process of
determining how your tables are related to each other. This process is done by defining and
creating relationships between the tables. From that point, you can enhance the model by defining
metrics and adding custom calculations to enrich your data.
Creating an effective and proper data model is a critical step in helping organizations understand
and gain valuable insights into the data. An effective data model makes reports more accurate,
allows the data to be explored faster and more efficient, decreases time for the report writing
process, and simplifies future report maintenance.
The model is another critical component that has a direct effect on the performance of your report
and overall data analysis. A poorly designed model can have a drastically negative impact on the
general accuracy and performance of your report. Conversely, a well-designed model with well-
prepared data will ensure a properly efficient and trusted report. This notion is more prevalent
when you are working with data at scale.
From a Power BI perspective, if your report is performing slowly, or your refreshes are taking a
long time, you will likely need to revisit the data preparation and modeling tasks to optimize your
report.
The process of preparing data and modeling data is an iterative process. Data preparation is the
first task in data analysis. Understanding and preparing your data before you model it will make
the modeling step much easier.
Visualize
The visualization task is where you get to bring your data to life. The ultimate goal of the visualize
task is to solve business problems. A well-designed report should tell a compelling story about
that data, which will enable business decision makers to quickly gain needed insights. By using
appropriate visualizations and interactions, you can provide an effective report that guides the
reader through the content quickly and efficiently, therefore allowing the reader to follow a
narrative into the data.
The reports that are created during the visualization task help businesses and decision makers
understand what that data means so that accurate and vital decisions can be made. Reports drive
the overall actions, decisions, and behaviors of an organization that is trusting and relying on the
information that is discovered in the data.
9
The business might communicate that they need all data points on a given report to help them
make decisions. As a data analyst, you should take the time to fully understand the problem that
the business is trying to solve. Determine whether all their data points are necessary because too
much data can make detecting key points difficult. Having a small and concise data story can help
find insights quickly.
With the built-in AI capabilities in Power BI, data analysts can build powerful reports, without
writing any code, that enable users to get insights and answers and find actionable objectives. The
AI capabilities in Power BI, such as the built-in AI visuals, enable the discovering of data by asking
questions, using the Quick Insights feature, or creating machine learning models directly within
Power BI.
An important aspect of visualizing data is designing and creating reports for accessibility. As you
build reports, it is important to think about people who will be accessing and reading the reports.
Reports should be designed with accessibility in mind from the outset so that no special
modifications are needed in the future.
Many components of your report will help with storytelling. From a color scheme that is
complementary and accessible, to fonts and sizing, to picking the right visuals for what is being
displayed, they all come together to tell that story.
Analyze
The analyze task is the important step of understanding and interpreting the information that is
displayed on the report. In your role as a data analyst, you should understand the analytical
capabilities of Power BI and use those capabilities to find insights, identify patterns and trends,
predict outcomes, and then communicate those insights in a way that everyone can understand.
Advanced analytics enables businesses and organizations to ultimately drive better decisions
throughout the business and create actionable insights and meaningful results. With advanced
analytics, organizations can drill into the data to predict future patterns and trends, identify
activities and behaviors, and enable businesses to ask the appropriate questions about their data.
Previously, analyzing data was a difficult and intricate process that was typically performed by data
engineers or data scientists. Today, Power BI makes data analysis accessible, which simplifies the
data analysis process. Users can quickly gain insights into their data by using visuals and metrics
directly from their desktop and then publish those insights to dashboards so that others can find
needed information.
This feature is another area where AI integrations within Power BI can take your analysis to the
next level. Integrations with Azure machine learning, cognitive services, and built-in AI visuals will
help to enrich your data and analysis.
10
Manage
Power BI consists of many components, including reports, dashboards, workspaces, datasets, and
more. As a data analyst, you are responsible for the management of these Power BI assets,
overseeing the sharing and distribution of items, such as reports and dashboards, and ensuring
the security of Power BI assets.
Apps can be a valuable distribution method for your content and allow easier management for
large audiences. This feature also allows you to have custom navigation experiences and link to
other assets within your organization to complement your reports.
The management of your content helps to foster collaboration between teams and individuals.
Sharing and discovery of your content is important for the right people to get the answers that
they need. It is also important to help ensure that items are secure. You want to make sure that
the right people have access and that you are not leaking data past the correct stakeholders.
Proper management can also help reduce data silos within your organization. Data duplication can
make managing and introducing data latency difficult when resources are overused. Power BI
helps reduce data silos with the use of shared datasets, and it allows you to reuse data that you
have prepared and modeled. For key business data, endorsing a dataset as certified can help to
ensure trust in that data.
Introduction
Like most of us, you work for a company where you're required to build Microsoft Power BI
reports. The data resides in several different databases and files. These data repositories are
different from each other, some are in Microsoft SQL Server, some are in Microsoft Excel, but all
the data is related.
11
Before you can create reports, you must first extract data from the various data sources.
Interacting with SQL Server is different from Excel, so you should learn the nuances of both
systems. After gaining understanding of the systems, you can use Power Query to help you clean
the data, such as renaming columns, replacing values, removing errors, and combining query
results. Power Query is also available in Excel. After the data has been cleaned and organized,
you're ready to build reports in Power BI. Finally, you'll publish your combined dataset and reports
to Power BI service. From there, other people can use your dataset and build their own reports or
they can use the reports you’ve already built. Additionally, if someone else built a dataset you'd
like to use, you can build reports from that too!
12
Power BI Desktop allows you to get data from many types of files. You can find a list of the
available options when you use the Get data feature in Power BI Desktop. The following sections
explain how you can import data from an Excel file that is stored on a local computer.
The first step is to determine which file location you want to use to export and store your data.
• Local - You can import data from a local file into Power BI. The file isn't moved into Power BI,
and a link doesn't remain to it. Instead, a new dataset is created in Power BI, and data from the
Excel file is loaded into it. Accordingly, changes to the original Excel file aren't reflected in your
Power BI dataset. You can use local data import for data that doesn't change.
• OneDrive for Business - You can pull data from OneDrive for Business into Power BI. This
method is effective in keeping an Excel file and your dataset, reports, and dashboards in Power
BI synchronized. Power BI connects regularly to your file on OneDrive. If any changes are found,
your dataset, reports, and dashboards are automatically updated in Power BI.
• OneDrive - Personal - You can use data from files on a personal OneDrive account, and get
many of the same benefits that you would with OneDrive for Business. However, you'll need to
sign in with your personal OneDrive account, and select the Keep me signed in option. Check
with your system administrator to determine whether this type of connection is allowed in your
organization.
• SharePoint - Team Sites - Saving your Power BI Desktop files to SharePoint Team Sites is
similar to saving to OneDrive for Business. The main difference is how you connect to the file
from Power BI. You can specify a URL or connect to the root folder.
13
Using a cloud option such as OneDrive or SharePoint Team Sites is the most effective way to keep
your file and your dataset, reports, and dashboards in Power BI in-sync. However, if your data
doesn't change regularly, saving files on a local computer is a suitable option.
In Power BI, on the Home tab, select Get data. In the list that displays, select the option that you
require, such as Text/CSV or XML. For this example, you'll select Excel.
Tip
The Home tab contains quick access data source options, such as Excel, next to the Get
data button.
Depending on your selection, you need to find and open your data source. You might be
prompted to sign into a service, such as OneDrive, to authenticate your request. In this example,
14
you'll open the Employee Data Excel workbook that is stored on the Desktop (Remember, no files
are provided for practice, these are hypothetical steps).
After the file has connected to Power BI Desktop, the Navigator window opens. This window
shows you the data that is available in your data source (the Excel file in this example). You can
select a table or entity to preview its contents, to ensure that the correct data is loaded into the
Power BI model.
Select the check box(es) of the table(s) that you want to bring in to Power BI. This selection
activates the Load and Transform Data buttons as shown in the following image.
15
Now you can select the Load button to automatically load your data into the Power BI model or
select the Transform Data button to launch the Power Query Editor, where you can review and
clean your data before loading it into the Power BI model.
We often recommend that you transform data, but that process will be discussed later in this
module. For this example, you can select Load.
You might have to change the location of a source file for a data source during development, or if
a file storage location changes. To keep your reports up to date, you'll need to update your file
connection paths in Power BI.
Power Query provides many ways for you to accomplish this task, so that you can make this type
of change when needed.
If you are changing a file path, make sure that you reconnect to the same file with the same file
structure. Any structural changes to a file, such as deleting or renaming columns in the source file,
will break the reporting model.
For example, try changing the data source file path in the data source settings. Select Data source
settings in Power Query. In the Data source settings window, select your file and then
select Change Source. Update the File path or use the Browse option to locate your file,
select OK, and then select Close.
16
The management of Power BI assets helps reduce the duplication of efforts and helps ensure
security of the data.
Connecting Power BI to your database will help you to monitor the progress of your business and
identify trends, so you can forecast sales figures, plan budgets and set performance indicators and
targets. Power BI Desktop can connect to many relational databases that are either in the cloud or
on-premises.
17
Connect to data in a relational database
You can use the Get data feature in Power BI Desktop and select the applicable option for your
relational database. For this example, you would select the SQL Server option, as shown in the
following screenshot.
Tip
Next to the Get Data button are quick access data source options, such as SQL Server.
18
Your next step is to enter your database server name and a database name in the SQL Server
database window. The two options in data connectivity mode are: Import (selected by default,
recommended) and DirectQuery. Mostly, you select Import. Other advanced options are also
available in the SQL Server database window, but you can ignore them for now.
19
After you've added your server and database names, you'll be prompted to sign in with a
username and password. You'll have three sign-in options:
Select a sign-in option, enter your username and password, and then select Connect.
After the database has been connected to Power BI Desktop, the Navigator window displays the
data that is available in your data source (the SQL database in this example). You can select a table
or entity to preview its contents and make sure that the correct data will be loaded into the Power
BI model.
Select the check box(es) of the table(s) that you want to bring in to Power BI Desktop, and then
select either the Load or Transform Data option.
• Load - Automatically load your data into a Power BI model in its current state.
20
• Transform Data - Open your data in Microsoft Power Query, where you can perform actions
such as deleting unnecessary rows or columns, grouping your data, removing errors, and many
other data quality tasks.
Another way you can import data is to write an SQL query to specify only the tables and columns
that you need.
To write your SQL query, on the SQL Server database window, enter your server and database
names, and then select the arrow next to Advanced options to expand this section and view your
options. In the SQL statement box, write your query statement, and then select OK. In this
example, you'll use the Select SQL statement to load the ID, NAME and SALESAMOUNT
columns from the SALES table.
21
Change data source settings
After you create a data source connection and load data into Power BI Desktop, you can return
and change your connection settings at any time. This action is often required due to a security
policy within the organization, for example, when the password needs to be updated every 90
days. You can change the data source, edit permissions or clear permissions.
On the Home tab, select Transform data, and then select the Data source settings option.
22
From the list of data sources that displays, select the data source that you want to update. Then,
you can right-click that data source to view the available update options or you can use the
update option buttons on the lower left of the window. Select the update option that you need,
change the settings as required, and then apply your changes.
You can also change your data source settings from within Power Query. Select the table, and then
select the Data source settings option on the Home ribbon. Alternatively, you can go to
the Query Settings panel on the right side of the screen and select the settings icon next to
Source (or double Select Source). In the window that displays, update the server and database
details, and then select OK.
23
After you have made the changes, select Close and Apply to apply those changes to your data
source settings.
As previously mentioned, you can import data into your Power BI model by using an SQL query.
SQL stands for Structured Query Language and is a standardized programming language that is
used to manage relational databases and perform various data management operations.
Consider the scenario where your database has a large table that is comprised of sales data over
several years. Sales data from 2009 isn't relevant to the report that you're creating. This situation is
where SQL is beneficial because it allows you to load only the required set of data by specifying
exact columns and rows in your SQL statement and then importing them into your data model.
You can also join different tables, run specific calculations, create logical statements, and filter data
in your SQL query.
The following example shows a simple query where the ID, NAME and SALESAMOUNT are
selected from the SALES table.
The SQL query starts with a Select statement, which allows you to choose the specific fields that
you want to pull from your database. In this example, you want to load the ID, NAME, and
SALESAMOUNT columns.
SQLCopy
SELECT
ID
, NAME
24
, SALESAMOUNT
FROM
FROM specifies the name of the table that you want to pull the data from. In this case, it's the
SALES table. The following example is the full SQL query:
SQLCopy
SELECT
ID
, NAME
, SALESAMOUNT
FROM
SALES
When using an SQL query to import data, try to avoid using the wildcard character (*) in your
query. If you use the wildcard character (*) in your SELECT statement, you import all columns that
you don't need from the specified table.
The following example shows the query using the wildcard character.
SQLCopy
SELECT *
FROM
SALES
The wildcard character (*) will import all columns within the Sales table. This method isn't
recommended because it will lead to redundant data in your data model, which will cause
performance issues and require extra steps to normalize your data for reporting.
All queries should also have a WHERE clause. This clause will filter the rows to pick only filtered
records that you want. In this example, if you want to get recent sales data after January 1st, 2020,
add a WHERE clause. The evolved query would look like the following example.
SQLCopy
SELECT
ID
, NAME
, SALESAMOUNT
FROM
SALES
WHERE
OrderDate >= ‘1/1/2020’
It's a best practice to avoid doing this directly in Power BI. Instead, consider writing a query like
this in a view. A view is an object in a relational database, similar to a table. Views have rows and
columns, and can contain almost every operator in the SQL language. If Power BI uses a view,
when it retrieves data, it participates in query folding, a feature of Power Query. Query folding will
25
be explained later, but in short, Power Query will optimize data retrieval according to how the data
is being used later.
In this scenario, you will use the Get data feature in Power BI Desktop. However, this time you will
select the More... option to locate and connect to the type of database that you use. In this
example, you will select the Azure category, select Azure Cosmos DB, and then select Connect.
On the Preview Connector window, select Continue and then enter your database credentials. In
this example, on the Azure Cosmos DB window, you can enter the database details. You can
specify the Azure Cosmos DB account endpoint URL that you want to get the data from (you can
26
get the URL from the Keys blade of your Azure portal). Alternatively, you can enter the database
name, collection name or use the navigator to select the database and collection to identify the
data source.
If you are connecting to an endpoint for the first time, as you are in this example, make sure that
you enter your account key. You can find this key in the Primary Key box in the Read-only
Keys blade of your Azure portal.
JSON type records must be extracted and normalized before you can report on them, so you need
to transform the data before loading it into Power BI Desktop.
After you have connected to the database account, the Navigator window opens, showing a list of
databases under that account. Select the table that you want to import. In this example, you will
select the Product table. The preview pane only shows Record items because all records in the
document are represented as a Record type in Power BI.
27
Select the Edit button to open the records in Power Query.
In Power Query, select the Expander button to the right side of the Column1 header, which will
display the context menu with a list of fields. Select the fields that you want to load into Power BI
Desktop, clear the Use original column name as prefix checkbox, and then select OK.
Review the selected data to ensure that you are satisfied with it, then select Close & Apply to load
the data into Power BI Desktop.
28
The data now resembles a table with rows and columns. Data from Cosmos DB can now be related
to data from other data sources and can eventually be used in a Power BI report.
When connecting to data in an application, you would begin in the same way as you would when
connecting to the other data sources: by selecting the Get data feature in Power BI Desktop. Then,
select the option that you need from the Online Services category. In this example, you
select SharePoint Online List.
After you've selected Connect, you'll be asked for your SharePoint URL. This URL is the one that
you use to sign into your SharePoint site through a web browser. You can copy the URL from your
SharePoint site and paste it into the connection window in Power BI. You don't need to enter your
full URL file path; you only need to load your site URL because, when you're connected, you can
select the specific list that you want to load. Depending on the URL that you copied, you might
need to delete the last part of your URL, as illustrated in the following image.
29
After you've entered your URL, select OK. Power BI needs to authorize the connection to
SharePoint, so sign in with your Microsoft account and then select Connect.
After Power BI has made the connection with SharePoint, the Navigator window appears, as it
does when you connect to other data sources. The window displays the tables and entities within
your SharePoint site. Select the list that you want to load into Power BI Desktop. Similar to when
you import from other data sources, you have the option to automatically load your data into
Power BI model or launch the Power Query Editor to transform your data before loading it.
30
Select a storage mode
The most popular way to use data in Power BI is to import it into a Power BI dataset. Importing the
data means that the data is stored in the Power BI file and gets published along with the Power BI
reports. This process helps make it easier for you to interact directly with your data. However, this
approach might not work for all organizations.
To continue with the scenario, you're building Power BI reports for the Sales department at
Tailwind Traders, where importing the data isn't an ideal method. The first task you need to
accomplish is to create your datasets in Power BI so you can build visuals and other report
elements. The Sales department has many different datasets of varying sizes. For security reasons,
you aren't allowed to import local copies of the data into your reports, so directly importing data
is no longer an option. Therefore, you need to create a direct connection to the Sales
department’s data source. The following section describes how you can ensure that these business
requirements are satisfied when you're importing data into Power BI.
However, sometimes there may be security requirements around your data that make it impossible
to directly import a copy. Or your datasets may simply be too large and would take too long to
load into Power BI, and you want to avoid creating a performance bottleneck. Power BI solves
these problems by using the DirectQuery storage mode, which allows you to query the data in the
data source directly and not import a copy into Power BI. DirectQuery is useful because it ensures
you're always viewing the most recent version of the data.
The three different types of storage modes you can choose from:
• Import
• DirectQuery
• Dual (Composite)
31
You can access storage modes by switching to the Model view, selecting a data table, and in the
resulting Properties pane, selecting which mode that you want to use from the Storage
mode drop-down list, as shown in the following visual.
Import mode
The Import mode allows you to create a local Power BI copy of your datasets from your data
source. You can use all Power BI service features with this storage mode, including Q&A and Quick
Insights. Data refreshes can be scheduled or on-demand. Import mode is the default for creating
new Power BI reports.
DirectQuery mode
The DirectQuery option is useful when you don't want to save local copies of your data because
your data won't be cached. Instead, you can query the specific tables that you'll need by using
native Power BI queries, and the required data will be retrieved from the underlying data source.
Essentially, you're creating a direct connection to the data source. Using this model ensures that
you're always viewing the most up-to-date data, and that all security requirements are satisfied.
Additionally, this mode is suited for when you have large datasets to pull data from. Instead of
slowing down performance by having to load large amounts of data into Power BI, you can use
DirectQuery to create a connection to the source, solving data latency issues as well.
In Dual mode, you can identify some data to be directly imported and other data that must be
queried. Any table that is brought in to your report is a product of both Import and DirectQuery
modes. Using the Dual mode allows Power BI to choose the most efficient form of data retrieval.
32
Get data from Azure Analysis Services
Azure Analysis Services is a fully managed platform as a service (PaaS) that provides enterprise-
grade data models in the cloud. You can use advanced mashup and modeling features to combine
data from multiple data sources, define metrics, and secure your data in a single, trusted tabular
semantic data model. The data model provides an easier and faster way for users to perform ad
hoc data analysis using tools like Power BI.
To resume the scenario, Tailwind Traders uses Azure Analysis Services to store financial projection
data. You’ve been asked to compare this data with actual sales data in a different database.
Getting data from Azure Analysis Services server is similar to getting data from SQL Server, in that
you can:
Notable differences between Azure Analysis Services and SQL Server are:
As previously mentioned, you use the Get data feature in Power BI Desktop. When you
select Analysis Services, you're prompted for the server address and the database name with two
options: Import and Connect live.
Connect live is an option for Azure Analysis Services. Azure Analysis Services uses the tabular
model and DAX to build calculations, similar to Power BI. These models are compatible with one
another. Using the Connect live option helps you keep the data and DAX calculations in their
original location, without having to import them all into Power BI. Azure Analysis Services can have
a fast refresh schedule, which means that when data is refreshed in the service, Power BI reports
will immediately be updated, without the need to initiate a Power BI refresh schedule. This process
can improve the timeliness of the data in your report.
Similar to a relational database, you can choose the tables that you want to use. If you want to
directly query the Azure Analysis Services model, you can use DAX or MDX.
You'll likely import the data directly into Power BI. An acceptable alternative is to import all other
data that you want (from Excel, SQL Server, and so on) into the Azure Analysis Services model and
33
then use a live connection. This approach simplifies your solution by keeping the data modeling
and DAX measures in one place.
Consider the scenario where you're building reports for the Sales team in your organization.
You’ve imported your data, which is in several tables within the Sales team’s SQL database, by
creating a data connection to the database through DirectQuery. When you create preliminary
visuals and filters, you notice that some tables are queried faster than others, and some filters are
taking longer to process compared to others.
The performance in Power Query depends on the performance at the data source level. The variety
of data sources that Power Query offers is wide, and the performance tuning techniques for each
source are equally wide. For instance, if you extract data from a Microsoft SQL Server, you should
follow the performance tuning guidelines for the product. Good SQL Server performance tuning
techniques include index creation, hardware upgrades, execution plan tuning, and data
compression. These topics are beyond the scope here, and are covered only as an example to
build familiarity with your data source and reap the benefits when using Power BI and Power
Query.
Power Query takes advantage of good performance at the data source through a technique called
Query Folding.
Query folding
The query folding within Power Query Editor helps you increase the performance of your Power BI
reports. Query folding is the process by which the transformations and edits that you make in
Power Query Editor are simultaneously tracked as native queries, or simple Select SQL statements,
while you're actively making transformations. The reason for implementing this process is to
ensure that these transformations can take place in the original data source server and don't
overwhelm Power BI computing resources.
You can use Power Query to load data into Power BI. Then use Power Query Editor to transform
your data, such as renaming or deleting columns, appending, parsing, filtering, or grouping your
data.
34
Consider a scenario where you’ve renamed a few columns in the Sales data and merged a city and
state column together in the “city state” format. Meanwhile, the query folding feature tracks those
changes in native queries. Then, when you load your data, the transformations take place
independently in the original source, this ensures that performance is optimized in Power BI.
• More efficiency in data refreshes and incremental refreshes. When you import
data tables by using query folding, Power BI is better able to allocate resources and refresh the
data faster because Power BI doesn't have to run through each transformation locally.
• Automatic compatibility with DirectQuery and Dual storage modes. All
DirectQuery and Dual storage mode data sources must have the back-end server processing
abilities to create a direct connection, which means that query folding is an automatic capability
that you can use. If all transformations can be reduced to a single Select statement, then query
folding can occur.
The following scenario shows query folding in action. In this scenario, you apply a set of queries to
multiple tables. After you add a new data source by using Power Query, and you're directed to the
Power Query Editor, you go to the Query Settings pane and right-click the last applied step, as
shown in the following figure.
If the View Native Query option isn't available (not displayed in bold type), then query folding
isn't possible for this step, and you'll have to work backward in the Applied Steps area until you
reach the step in which View Native Query is available (displays in bold type). This process will
reveal the native query that is used to transform the dataset.
A good guideline to remember is that if you can translate a transformation into a Select SQL
statement, which includes operators and clauses such as GROUP BY, SORT BY, WHERE, UNION
ALL, and JOIN, you can use query folding.
While query folding is one option to optimize performance when retrieving, importing, and
preparing data, another option is query diagnostics.
Query diagnostics
Another tool that you can use to study query performance is query diagnostics. You can determine
what bottlenecks may exist while loading and transforming your data, refreshing your data in
Power Query, running SQL statements in Query Editor, and so on.
35
To access query diagnostics in Power Query Editor, go to Tools in the Home ribbon. When you're
ready to begin transforming your data or making other edits in Power Query Editor, select Start
Diagnostics in the Session Diagnostics section. When you're finished, make sure that you
select Stop Diagnostics.
Selecting Diagnose Step shows you the length of time that it takes to run that step, as shown in
the following image. This selection can tell you if a step takes longer to complete than others,
which then serves as a starting point for further investigation.
This tool is useful when you want to analyze performance on the Power Query side for tasks such
as loading datasets, running data refreshes, or running other transformative tasks.
• Process as much data as possible in the original data source. Power Query and Power Query
Editor allow you to process the data; however, the processing power that is required to complete
this task might lower performance in other areas of your reports. Generally, a good practice is to
process, as much as possible, in the native data source.
• Use native SQL queries. When using DirectQuery for SQL databases, such as the case for our
scenario, make sure that you aren't pulling data from stored procedures or common table
expressions (CTEs).
• Separate date and time, if bound together. If any of your tables have columns that combine
date and time, make sure that you separate them into distinct columns before importing them
into Power BI. This approach will increase compression abilities.
The following sections cover some of the more common error messages that you might encounter
in Power BI.
36
Query timeout expired
Relational source systems often have many people who are concurrently using the same data in
the same database. Some relational systems and their administrators seek to limit a user from
monopolizing all hardware resources by setting a query timeout. These timeouts can be
configured for any timespan, from as little as five seconds to as much as 30 minutes or more.
For instance, if you’re pulling data from your organization’s SQL Server, you might see the error
shown in the following figure.
This error indicates that you’ve pulled too much data according to your organization’s policies.
Administrators incorporate this policy to avoid slowing down a different application or suite of
applications that might also be using that database.
You can resolve this error by pulling fewer columns or rows from a single table. While you're
writing SQL statements, it might be a common practice to include groupings and aggregations.
You can also join multiple tables in a single SQL statement. Additionally, you can perform
complicated subqueries and nested queries in a single statement. These complexities add to the
query processing requirements of the relational system and can greatly elongate the time of
implementation.
If you need the rows, columns, and complexity, consider taking small chunks of data and then
bringing them back together by using Power Query. For instance, you can combine half the
37
columns in one query and the other half in a different query. Power Query can merge those two
queries back together after you're finished.
Occasionally, you may encounter the “We couldn’t find any data formatted as a table” error while
importing data from Microsoft Excel. Fortunately, this error is self-explanatory. Power BI expects to
find data formatted as a table from Excel. The error event tells you the resolution. Perform the
following steps to resolve the issue:
1. Open your Excel workbook, and highlight the data that you want to import.
2. Press the Ctrl-T keyboard shortcut. The first row will likely be your column headers.
3. Verify that the column headers reflect how you want to name your columns. Then,
try to import data from Excel again. This time, it should work.
While importing data from a file, you may get the "Couldn't find file" error.
Usually, this error is caused by the file moving locations or the permissions to the file changing. If
the cause is the former, you need to find the file and change the source settings.
38
1. Open Power Query by selecting the Transform Data button in Power BI.
2. Highlight the query that is creating the error.
3. On the left, under Query Settings, select the gear icon next to Source.
Sometimes, when you import data into Power BI, the columns appear blank. This situation
happens because of an error in interpreting the data type in Power BI. The resolution to this error
is unique to the data source. For instance, if you're importing data from SQL Server and see blank
columns, you could try to convert to the correct data type in the query.
39
Instead of using this query:
By specifying the correct type at the data source, you eliminate many of these common data
source errors.
You may encounter different types of errors in Power BI that are caused by the diverse data source
systems where your data resides.
If you experience an error not covered, you can search Microsoft documentation for the error
message, and the resolution you need.
Introduction
Creating a great data model is one of the most important tasks that a data analyst can perform in
Microsoft Power BI. By doing this job well, you help make it easier for people to understand your
data, which will make building valuable Power BI reports easier for them and for you.
The pages in this module are instructional only, no data files are provided. You will have a chance
to work with real data in the labs.
Providing set rules for what makes a good data model is difficult because all data is different, and
the usage of that data varies. Generally, a smaller data model is better because it will perform
faster and will be simpler to use. However, defining what a smaller data model entails is equally as
problematic because it's a heuristic and subjective concept.
Typically, a smaller data model is comprised of fewer tables and fewer columns in each table that
the user can see. If you import all necessary tables from a sales database, but the total table count
is 30 tables, the user will not find that intuitive. Collapsing those tables into five tables will make
the data model more intuitive to the user, whereas if the user opens a table and finds 100
columns, they might find it overwhelming. Removing unneeded columns to provide a more
40
manageable number will increase the likelihood that the user will read all column names. To
summarize, you should aim for simplicity when designing your data models.
The following image is an example data model. The boxes contain tables of data, where each line
item within the box is a column. The lines that connect the boxes represent relationships between
the tables. These relationships can be complex, even in such a simplistic model. The data model
can become easily disorganized, and the total table count in the model can gradually increase.
Keeping your data model simple, comprehensive, and accurate requires constant effort.
Relationships are defined between tables through primary and foreign keys. Primary keys are
column(s) that identify each unique, non-null data row. For instance, if you have a Customers
table, you could have an index that identifies each unique customer. The first row will have an ID
of 1, the second row an ID of 2, and so on. Each row is assigned a unique value, which can be
referred to by this simple value: the primary key. This process becomes important when you are
referencing rows in a different table, which is what foreign keys do. Relationships between tables
are formed when you have primary and foreign keys in common between different tables.
Power BI allows relationships to be built from tables with different data sources, a powerful
function that enables you to pull one table from Microsoft Excel and another from a relational
41
database. You would then create the relationship between those two tables and treat them as a
unified dataset.
Now that you have learned about the relationships that make up the data schema, you'll be able
to explore a specific type of schema design, the star schema, which is optimized for high
performance and usability.
Star schemas
You can design a star schema to simplify your data. It's not the only way to simplify your data, but
it is a popular method; therefore, every Power BI data analyst should understand it. In a star
schema, each table within your dataset is defined as a dimension or a fact table, as shown in the
following visual.
42
Fact tables contain observational or event data values: sales orders, product counts, prices,
transactional dates and times, and quantities. Fact tables can contain several repeated values. For
example, one product can appear multiple times in multiple rows, for different customers on
different dates. These values can be aggregated to create visuals. For instance, a visual of the total
sales orders is an aggregation of all sales orders in the fact table. With fact tables, it is common to
see columns that are filled with numbers and dates. The numbers can be units of measurement,
such as sale amount, or they can be keys, such as a customer ID. The dates represent time that is
being recorded, like order date or shipped date.
Dimension tables contain the details about the data in fact tables: products, locations, employees,
and order types. These tables are connected to the fact table through key columns. Dimension
tables are used to filter and group the data in fact tables. The dimension tables, by contrast,
contain unique values, for instance, one row for each product in the Products table and one row
for each customer in the Customer table. For the total sales orders visual, you could group the
data so that you see total sales orders by product, in which product is data in the dimension table.
Fact tables are usually much larger than dimension tables because numerous events occur in fact
tables, such as individual sales. Dimension tables are typically smaller because you are limited to
the number of items that you can filter and group on. For instance, a year contains only so many
months, and the United States is comprised of only a certain number of states.
Considering this information about fact tables and dimension tables, you might wonder how you
can build this visual in Power BI.
The pertinent data resides in two tables, Employee and Sales, as shown in the following data
model. Because the Sales table contains the sales order values, which can be aggregated, it is
considered a fact table. The Employee table contains the specific employee name, which filters the
sales orders, so it would be a dimension table. The common column between the two tables,
which is the primary key in the Employee table, is EmployeeID, so you can establish a relationship
between the two tables based on this column.
43
When creating this relationship, you can build the visual according to the requirements, as shown
in the following figure. If you did not establish this relationship, while keeping in mind the
commonality between the two tables, you would have had more difficulty building your visual.
44
Star schemas and the underlying data model are the foundation of organized reports; the more
time you spend creating these connections and design, the easier it will be to create and maintain
reports.
• Be simple to navigate because of column and table properties that are specific and user-
friendly.
• Have merged or appended tables to simplify the tables within your data structure.
• Have good-quality relationships between tables that make sense.
The following sections further explain how you might work with your tables to ensure a simple and
readable table structure.
Assuming that you've already retrieved your data and cleaned it in Power Query, you can then go
to the Model tab, where the data model is located. The following image shows how the
relationship between the Order and Sales tables can be seen through the OrderDate column.
45
To manage these relationships, go to Manage Relationships on the ribbon, where the following
window will appear.
46
In this view, you can create, edit, and delete relationships between tables and also autodetect
relationships that already exist. When you load your data into Power BI, the Autodetect feature
will help you establish relationships between columns that are named similarly. Relationships can
be inactive or active. Only one active relationship can exist between tables, which is discussed in a
future module.
While the Manage Relationships feature allows you to configure relationships between tables,
you can also configure table and column properties to ensure organization in your table structure.
The Model view in Power BI desktop provides many options within the column properties that you
can view or update. A simple method to get to this menu to update the tables and fields is by
Ctrl+clicking or Shift+clicking items on this page.
47
48
Under the General tab, you can:
For instance, suppose that the dates in your column are formatted, as seen in the previous
screenshot, in the form of "Wednesday, March 14, 2001". If you want to change the format so that
the date was in the "mm/dd/yyyy" format, you would select the drop-down menu under All date
time formats and then choose the appropriate date format, as shown in the following figure.
49
After selecting the appropriate date format, return to the Date column, where you should see that
the format has indeed changed, as shown in the following figure.
50
Under the Advanced tab, you can:
Additionally, Power BI has a new functionality to update these properties on many tables and
fields by Ctrl+clicking or Shift+clicking items.
These examples are only some of the many types of transformations that you can make to simplify
the table structure. This step is important to take before you begin making your visuals so that you
don't have to go back and forth when making formatting changes. This process of formatting and
configuring tables can also be done in Power Query.
For example, suppose that you are developing reports for the Sales team at your organization. The
database contains tables for sales, orders, products, and more. You notice that many of these
tables, including Sales and Orders, contain their own date columns, as shown by
51
the ShipDate and OrderDate columns in the Sales and Orders tables. You are tasked with
developing a table of the total sales and orders by year and month. How can you build a visual
with multiple tables, each referencing their own date columns?
To solve this problem, you can create a common date table that can be used by multiple tables.
The following section explains how you can accomplish this task in Power BI.
• Source data
• DAX
• Power Query
Source data
Occasionally, source databases and data warehouses already have their own date tables. If the
administrator who designed the database did a thorough job, these tables can be used to perform
the following tasks:
Source data tables are mature and ready for immediate use. If you have a table as such, bring it
into your data model and don't use any other methods that are outlined in this section. We
52
recommend that you use a source date table because it is likely shared with other tools that you
might be using in addition to Power BI.
If you do not have a source data table, you can use other ways to build a common date table.
DAX
You can use the Data Analysis Expression (DAX) functions CALENDARAUTO() or CALENDAR() to
build your common date table. The CALENDAR() function returns a contiguous range of dates
based on a start and end date that are entered as arguments in the function. Alternatively, the
CALENDARAUTO() function returns a contiguous, complete range of dates that are automatically
determined from your dataset. The starting date is chosen as the earliest date that exists in your
dataset, and the ending date is the latest date that exists in your dataset plus data that has been
populated to the fiscal month that you can choose to include as an argument in the
CALENDARAUTO() function. For the purposes of this example, the CALENDAR() function is used
because you only want to see the data from May 31, 2011 (the first day that Sales began its
tracking of this data) and forward for the next 10 years.
In Power BI Desktop, go to the Table tab on the ribbon. Select New Table, and then enter in the
following DAX formula:
DAXCopy
Now, you have a column of dates that you can use. However, this column is slightly sparse. You
also want to see columns for just the year, the month number, the week of the year, and the day of
the week. You can accomplish this task by selecting New Column on the ribbon and entering the
following DAX equation, which will retrieve the year from your Date table.
DAXCopy
Year = YEAR(Dates[Date])
53
You can perform the same process to retrieve the month number, week number, and day of the
week:
DAXCopy
MonthNum = MONTH(Dates[Date])
DAXCopy
WeekNum = WEEKNUM(Dates[Date])
DAXCopy
When you have finished, your table will contain the columns that are shown in the following
figure.
You have now created a common date table by using DAX. This process only adds your new table
to the data model; you will still need to establish relationships between your date table and the
54
Sales and Order tables, and then mark your table as the official date table of your data model.
However, before you complete those tasks, make sure that you consider another way of building a
common date table: by using Power Query.
Power Query
You can use M-language, the development language that is used to build queries in Power Query,
to define a common date table.
Select Transform Data in Power BI Desktop, which will direct you to Power Query. In the blank
space of the left Queries pane, right-click to open the following drop-down menu, where you will
select New Query > Blank Query.
In the resulting New Query view, enter the following M-formula to build a calendar table:
MDXCopy
55
For your sales data, you want the start date to reflect the earliest date that you have in your data:
May 31, 2011. Additionally, you want to see dates for the next 11 years, including dates in the
future. This approach ensures that, as new sales data flows in, you won't have to re-create this
table. You can also change duration. In this case, you want a data point for every day, but you can
also increment by hours, minutes, and seconds. The following figure shows the result.
After you have realized success in the process, you notice that you have a list of dates instead of a
table of dates. To correct this error, go to the Transform tab on the ribbon and select Convert >
To Table. As the name suggests, this feature will convert your list into a table. You can also
rename the column to DateCol.
56
Next, you want to add columns to your new table to see dates in terms of year, month, week, and
day so that you can build a hierarchy in your visual. Your first task is to change the column type by
selecting the icon next to the name of the column and, in the resulting drop-down menu, selecting
the Date type.
57
After you have finished selecting the Date type, you can add columns for year, months, weeks, and
days. Go to Add Column, select the drop-down menu under Date, and then select Year, as shown
in the following figure.
58
Notice that Power BI has added a column of all years that are pulled from DateCol.
Complete the same process for months, weeks, and days. After you have finished this process, the
table will contain the columns that are shown in the following figure.
59
You have now successfully used Power Query to build a common date table.
The previous steps show how to get the table into the data model. Now, you need to mark your
table as the official date table so that Power BI can recognize it for all future values and ensure
that formatting is correct.
Your first task in marking your table as the official date table is to find the new table on
the Fields pane. Right-click the name of the table and then select Mark as date table, as shown in
the following figure.
60
By marking your table as a date table, Power BI performs validations to ensure that the data
contains zero null values, is unique, and contains continuous date values over a period. You can
61
also choose specific columns in your table to mark as the date, which can be useful when you have
many columns within your table. Right-click the table, select Mark as date table, and then
select Date table settings. The following window will appear, where you can choose which
column should be marked as Date.
Selecting Mark as date table will remove autogenerated hierarchies from the Date field in the
table that you marked as a date table. For other date fields, the auto hierarchy will still be present
until you establish a relationship between that field and the date table or until you turn off
the Auto Date/Time feature. You can manually add a hierarchy to your common date table by
right-clicking the year, month, week, or day columns in the Fields pane and then selecting New
hierarchy. This process is further discussed later in this module.
To build your visual between the Sales and Orders tables, you will need to establish a relationship
between this new common date table and the Sales and Orders tables. As a result, you will be able
to build visuals by using the new date table. To complete this task, go to Model tab > Manage
Relationships, where you can create relationships between the common date table and the
Orders and Sales tables by using the OrderDate column. The following screenshot shows an
example of one such relationship.
62
After you have built the relationships, you can build your Total Sales and Order Quantity by
Time visual with your common date table that you developed by using the DAX or Power Query
method.
To determine the total sales, you need to add all sales because the Amount column in the Sales
table only looks at the revenue for each sale, not the total sales revenue. You can complete this
task by using the following measure calculation, which will be explained in later discussions. The
calculation that you will use when building this measure is as follows:
DAXCopy
After you have finished, you can create a table by returning to the Visualizations tab and selecting
the Table visual. You want to see the total orders and sales by year and month, so you only want
63
to include the Year and Month columns from your date table, the OrderQty column, and
the #TotalSales measure. When you learn about hierarchies, you can also build a hierarchy that
will allow you drill down from years to months. For this example, you can view them side-by-side.
You have now successfully created a visual with a common date table.
• 6 minutes
When building a star schema, you will have dimension and fact tables. Fact tables contain
information about events such as sales orders, shipping dates, resellers, and suppliers. Dimension
tables store details about business entities, such as products or time, and are connected back to
fact tables through a relationship.
You can use hierarchies as one source to help you find detail in dimension tables. These
hierarchies form through natural segments in your data. For instance, you can have a hierarchy of
dates in which your dates can be segmented into years, months, weeks, and days. Hierarchies are
useful because they allow you to drill down into the specifics of your data instead of only seeing
the data at a high level.
64
Hierarchies
When you are building visuals, Power BI automatically enters values of the date type as a hierarchy
(if the table has not been marked as a date table).
In the preceding Date column, the date is shown in increasingly finer detail through year, quarters,
months, and days. You can also manually create hierarchies.
For example, consider a situation where you want to create a stacked bar chart of Total Sales by
Category and Subcategory. You can accomplish this task by creating a hierarchy in
the Product table for categories and subcategories. To create a hierarchy, go to the Fields pane
on Power BI and then right-click the column that you want the hierarchy for. Select New
hierarchy, as shown in the following figure.
Next, drag and drop the subcategory column into this new hierarchy that you've created. This
column will be added as a sublevel on the hierarchy.
65
Now, you can build the visual by selecting a stacked bar chart in the Visualizations pane. Add
your Category Name Hierarchy in the Axis field and Total Sales in the Values field.
You can drill down on the visual to view both Category and Subcategory, depending on what
you want to see. Hierarchies allow you to view increasing levels of data on a single view.
66
Now that you have learned about hierarchies, you can take a step further and examine parent-
child hierarchies and their role in multiple relationships between fact tables and dimension tables.
Parent-child hierarchy
In the following example, you have an Employee table within the database that tells you important
information about the employees, their managers, and their IDs. When looking at this table, you
notice that Roy F has been repeated multiple times in the Manager column. As the image shows,
multiple employees can have the same manager, which indicates a hierarchy between managers
and employees.
The Manager column determines the hierarchy and is therefore the parent, while the "children"
are the employees. For this example, you want to be able to see all levels of this hierarchy. Power
BI does not default to showing you all levels of the hierarchy, so it is your responsibility to ensure
that you see all levels of this hierarchy or "flatten" it so that you can see more data granularity.
67
Flatten parent-child hierarchy
The process of viewing multiple child levels based on a top-level parent is known as flattening the
hierarchy. In this process, you are creating multiple columns in a table to show the hierarchical
path of the parent to the child in the same record. You will use PATH(), a simple DAX function that
returns a text version of the managerial path for each employee, and PATHITEM() to separate this
path into each level of managerial hierarchy.
Important
DAX has not been covered yet; however, it will be in another module. This function is included in
this section because it's explaining hierarchies. If use of DAX in this capacity is confusing, refer to
the DAX module and then return to this section afterward.
While on the table, go to the Modeling tab and select New Column. In the resulting formula bar,
enter the following function, which creates the text path between the employee and manager. This
action creates a calculated column in DAX.
DAXCopy
The completed path between the employee and the manager appears in the new column, as
shown in the following screenshot.
68
If you look at Roger M, the path of IDs is 1010 | 1011 | 1013, which means that one level above
Roger M (ID 1013) is his manager, Pam H (ID 1011), and one level above Pam H is her manager
Roy F (ID 1010). In this row, Roger M is on the bottom of the hierarchy, at the child level, and Roy
F is at the top of the hierarchy and is at the parent level. This path is created for every employee.
To flatten the hierarchy, you can separate each level by using the PATHITEM function.
To view all three levels of the hierarchy separately, you can create four columns in the same way
that you did previously, by entering the following equations. You will use the PATHITEM function
to retrieve the value that resides in the corresponding level of your hierarchy.
• Level 1 = PATHITEM(Employee[Path],1)
• Level 2 = PATHITEM(Employee[Path],2)
• Level 3 = PATHITEM(Employee[Path],3)
After you have finished, notice that you now have each level of hierarchy within your table. Roy F is
at the top of the hierarchy and, as you go through Levels 2-3, notice that the managers and
employees map with each other.
69
Now, you can create a hierarchy on the Fields pane, as you did previously. Right-click Level 1,
because this is the first hierarchy level, and then select New Hierarchy. Then, drag and drop Level
2 and Level 3 into this hierarchy.
You have now successfully flattened a hierarchy so that you can view individual levels.
Previously, you've considered dimensions that have only one relationship with a fact table.
However, situations do occur where your dimension table will have multiple relationships with a
fact table.
Role-playing dimensions
Role-playing dimensions have multiple valid relationships with fact tables, meaning that the same
dimension can be used to filter multiple columns or tables of data. As a result, you can filter data
differently depending on what information you need to retrieve. This topic is complex, so it is only
introduced in this section. Working with role-playing dimensions requires complex DAX functions
that will be discussed in later sections.
70
The preceding visual shows the Calendar, Sales, and Order tables. Calendar is the dimension table,
while Sales and Order are fact tables. The dimension table has two relationships: one with Sales
and one with Order. This example is of a role-playing dimension because the Calendar table can
be used to group data in both Sales and Order. If you wanted to build a visual in which the
Calendar table references the Order and the Sales tables, the Calendar table would act as a role-
playing dimension.
Data granularity is an important topic for all data analysts, regardless of the Power BI tools that
you are using. Defining the correct data granularity can have a big impact on the performance and
usability of your Power BI reports and visuals.
71
Data granularity defined
Consider a scenario where your company manages 1,000 refrigerated semi-trucks. Every few
minutes, each truck uses a Microsoft Azure IoT application to record its current temperature. This
temperature is important to your organization because, if the refrigeration were to malfunction, it
could spoil the entire load, costing thousands of dollars. With so many trucks and so many
sensors, extensive data is generated every day. Your report users don't want to sift through
numerous records to find the ones that they are particularly interested in.
How can you change the granularity of the data to make the dataset more usable?
In this scenario, you might want to import the data by using a daily average for each truck. That
approach would reduce the records in the database to one record for each truck for each day. If
you decide that the approach was acceptable enough for tracking costs and errors, then you could
use that data granularity. Alternatively, you could select the last recorded temperature, or you
could only import records that are above or below a normal range of temperatures. Any of these
methods will reduce the total records that you import, while still bringing in data that is
comprehensive and valuable.
For different scenarios, you could settle on data granularity that is defined weekly, monthly, or
quarterly. Generally, the fewer the records that you are working with, the faster your reports and
visuals will function. This approach translates to a faster refresh rate for the entire dataset, which
might mean that you can refresh more frequently.
However, that approach has a drawback. If your users want to drill into every single transaction,
summarizing the granularity will prevent them from doing that, which can have a negative impact
on the user experience. It is important to negotiate the level of data granularity with report users
so they understand the implications of these choices.
Data granularity can also have an impact when you are building relationships between tables in
Power BI.
For example, consider that you are building reports for the Sales team at Tailwind Traders. You
have been asked to build a matrix of total sales and budget over time by using the Calendar, Sales,
and Budget tables. You notice that the lowest level of time-based detail that the Sales table goes
into is by day, for instance 5/1/2020, 6/7/2020, and 6/18/2020. The Budget table only goes to the
monthly level, for instance, the budget data is 5/2020 and 6/2020.These tables have different
granularities that need to be reconciled before you can build a relationship between tables.
72
As shown in the preceding figure, a relationship between Budget and Calendar is missing.
Therefore, you need to create this relationship before you can build your visual. Notice that if you
transform the Year and Month columns in the Calendar table into a new column, and do the same
transformation in the Budget table, you can match the format of the Date column in the Calendar
table. Then, you can establish a relationship between the two columns. To complete this task, you
will concatenate the Year and Month columns and then change the format.
Select Transform Data on the ribbon. On Applied Steps, on the right pane, right-click the last
step and then select Insert Step After.
73
Under Add Column on the Home ribbon, select Custom Column. Enter the following equation,
which will concatenate the Year and Month columns, and then add a dash in between the column
names.
MCopy
Change the data type to Date and then rename the column. Your Budget table should resemble
the following figure.
74
Now, you can create a relationship between the Budget and the Calendar tables.
Power BI automatically detects relationships, but you can also go to Manage Relationships >
New and create the relationship on the Date column. The relationship should resemble the
following figure.
75
By completing this task, you have ensured that the granularity is the same between your different
tables. Now, you need to create DAX measures to calculate Total Sales and BudgetAmount. Go
to the Data pane on Power BI Desktop, select New Measure, and then create two measures with
the following equations:
DAXCopy
Select the table visual on the Visualization pane, and then enter these measures and
the Date into the Values field. You have now accomplished the goal of building a matrix of the
total sales and budgets over time.
76
Work with relationships and cardinality
Unlike other database management systems, Power BI has the concept of directionality to a
relationship. This directionality plays an important role in filtering data between multiple tables.
When you load data, Power BI automatically looks for relationships that exist within the data by
matching column names. You can also use Manage Relationships to edit these options manually.
For example, you've retrieved many tables from the Sales database, and the following image is an
example of your data model. Power BI has autodetected several relationships, but you can't
discern what they mean. You want to make sure that the relationships accurately reflect those that
exist in your data.
77
Relationships
The following are different types of relationships that you'll find in Power BI.
• Describes a relationship in which you have many instances of a value in one column that are
related to only one unique corresponding instance in another column.
• Describes the directionality between fact and dimension tables.
78
• Is the most common type of directionality and is the Power BI default when you are
automatically creating relationships.
• Describes a relationship in which only one instance of a value is common between two tables.
• Requires unique values in both tables.
• Is not recommended because this relationship stores redundant information and suggests that
the model is not designed correctly. It is better practice to combine the tables.
An example of a one-to-one relationship would be if you had products and product IDs in two
different tables. Creating a one-to-one relationship is redundant and these two tables should be
combined.
• Describes a relationship where many values are in common between two tables.
• Does not require unique values in either table in a relationship.
79
• Is not recommended; a lack of unique values introduces ambiguity and your users might not
know which column of values is referring to what.
For instance, the following figure shows a many-to-many relationship between the Sales and
Order tables on the OrderDate column because multiple sales can have multiple orders associated
with them. Ambiguity is introduced because both tables can have the same order date.
Cross-filter direction
• Only one table in a relationship can be used to filter the data. For instance, Table 1 can be
filtered by Table 2, but Table 2 cannot be filtered by Table 1.
Tip
Follow the direction of the arrow on the relationship between your tables to know which direction
the filter will flow. You typically want these arrows to point to your fact table.
• For a one-to-many or many-to-one relationship, the cross-filter direction will be from the "one"
side, meaning that the filtering will occur in the table that has many values.
80
• One table in a relationship can be used to filter the other. For instance, a dimension table can
be filtered through the fact table, and the fact tables can be filtered through the dimension
table.
• You might have lower performance when using bi-directional cross-filtering with many-to-many
relationships.
A word of caution regarding bi-directional cross-filtering: You should not enable bi-directional
cross-filtering relationships unless you fully understand the ramifications of doing so. Enabling it
can lead to ambiguity, over-sampling, unexpected results, and potential performance degradation.
For one-to-one relationships, the only option that is available is bi-directional cross-filtering. Data
can be filtered on either side of this relationship and result in one distinct, unambiguous value. For
instance, you can filter on one Product ID and be returned a single Product, and you can filter on a
Product and be returned a single Product ID.
For many-to-many relationships, you can choose to filter in a single direction or in both directions
by using bi-directional cross-filtering. The ambiguity that is associated with bi-directional cross-
filtering is amplified in a many-to-many relationship because multiple paths will exist between
different tables. If you create a measure, calculation, or filter, unintended consequences can occur
where your data is being filtered and, depending on which relationship that the Power BI engine
chooses when applying the filter, the final result might be different. This situation is also true for
bi-directional relationships and why you should be cautious when using them.
For this reason, many-to-many relationships and/or bi-directional relationships are complicated.
Unless you are certain what your data looks like when aggregated, these types of open-ended
relationships with multiple filtering directions can introduce multiple paths through the data.
Consider the scenario where you are tasked with building a visual that examines budgets for
customers and accounts. You can have multiple customers on the same account and multiple
accounts with the same customer, so you know that you need to create a many-to-many
relationship.
81
To create this relationship, go to Manage Relationships > New. In the resulting window, create a
relationship between the Customer ID column in CustomerTable and AccountTable. The
relationship is set to many-to-many, and the filter type is in both directions. Immediately, you will
be warned that you should only use this type of relationship if it is expected that neither column
will have unique values because you might get unexpected values. Because you want to filter in
both directions, choose bi-directional cross-filtering.
82
Resolve modeling challenges
Modeling data is about establishing and maintaining relationships so that you can effectively
visualize the data in the form that your business requires. When you are creating these
relationships, a common pitfall that you might encounter are circular relationships.
For example, you are developing reports for the Sales team and are examining the relationships
between tables. In a poorly designed data model, Table 1 has a many-to-one relationship with a
column in Table 2, but Table 2 has a one-to-many relationship with Table 3 that has its own
relationship with Table 1. This web of relationships is difficult to manage and becomes a daunting
task to build visuals because it is no longer clear what relationships exist. Therefore, it is important
that you are able to identify circular relationships so that your data is usable.
83
Relationship dependencies
For example, consider that you have the following calculated column Total in the Sales table.
TotalCost depends on Quantity and Price, so if a change occurs in either quantity or price, a
change will occur in TotalCost as well. This example outlines a dependency of a column on other
columns, but you can also have dependencies between measures, tables, and relationships.
Consider the following relationships between SalesPerson, Sales, and Customer. A change
in Customer will result in a change in Sales, which results in changes in SalesPerson. These types
of dependencies can exist within relationships.
After you've loaded and modeled your organization's data in Power BI Desktop, you will be ready
to start creating your reports. In this module, you'll use the report editor in Power BI Desktop to
add suitable visuals to your report canvas. You'll then customize those visuals to meet your
organization's requirements.
Consider a scenario where you work as a Power BI developer for Tailwind Traders. Your
organization wants to transform the way that it presents its data to management and
stakeholders. It wants to replace the current text and tabular report format with a more visual
84
approach so that users will find the reports more interesting. Additionally, by using a visual
approach, the company can provide users with quicker, easier access to the information that they
need to make their business decisions. You are tasked with creating a Power BI report that is
based on a combination of visuals that are customized to match your organization's branding and
report presentation requirements.
Power BI has a variety of visuals that you can use to report on the data in your data model. Visuals
allow you to present the important information and insights that you discovered in the data in a
compelling and insightful way. The report consumers rely on these visualizations as a gateway to
the underlying data.
In Power BI Desktop, each visual is represented by an icon in the Visualizations pane. The types of
visuals that are available include charts, maps, cards, a table, a matrix, and many more. You will
learn how to select the correct visual later in this module.
This module is instructional, you will have an opportunity to practice in the lab near the end of the
module.
In this example, you want to add a visualization to the report that displays sales data by category
name. You start by selecting the Category and Revenue fields in the Fields pane. Power BI
85
Desktop then automatically selects a visualization for you, depending on the data type of the fields
that you selected. In this case, the default visualization type is a table.
While the visual is selected, you can change the visualization type by selecting a different visual
from the Visualizations pane.
Depending on the type of data in your selected fields, one or more visualizations might not be
suitable. For example, geographic data will not display well as a funnel chart or line chart
visualization.
86
It is important that you choose an effective visualization to ensure that you display the data in the
best way possible. The following sections outline the different types of visualizations that are
available within Power BI Desktop, using the same data source for illustration purposes.
In the previous example, the Table visualization was selected by default. The table is a grid that
contains related data in a logical series of rows and columns. The table supports two dimensions
and it can also contain headers and a row for totals.
The Matrix visualization looks similar to the table visualization; however, it allows you to select
one or more elements (rows, columns, values) in the matrix to cross-highlight other visuals on the
report page. In the following image, notice that a new field called Product Color was added to the
columns, and the available colors are now spanning across the table, with the categories listed in
rows.
Power BI Desktop has a variety of bar and column chart visualizations that present specific data
across different categories in a stacked or clustered format. The stacked format will stack the
information items on top of each other.
87
For example, the following clustered column chart shows a single column with total sales for each
country, whereas the stacked column chart shows data for sales by country, by product name. All
sales data is stacked into one column to show you the total sales by country, broken down by how
much each product contributed to the overall total sales.
The line chart and area chart visualizations are beneficial in helping you present trends over time.
The basic area chart is based on the line chart, with the area between axis and line filled in. The
main difference between these two chart types is that the area chart highlights the magnitude of
change over time.
88
89
Pie chart, donut chart, and Treemaps
The pie chart, donut chart, and Treemap visualizations show you the relationship of parts to the
whole by dividing the data into segments. From a data analysis perspective, these charts are not
useful because interpreting the data that they present can be difficult. However, these charts are
often used for aesthetic reasons due to the colorful segments that they display. These charts are
best suited for illustrating percentages, such as the top five sales by product or country, or any
other available categories.
The pie chart is a solid circle, whereas the donut chart has a center that is blank and allows space
for a label or icon.
90
When using pie charts, donut charts, and Treemaps, try to avoid presenting too many categories
because it results in thin slices (or rectangles) that provide no added value to the user. If you do
need to present all categories in your dataset, it's better to use another type of visual, such as a
column chart.
Pie charts and donut charts present data by dividing it into slices, while the Treemap visualization
displays data as a set of nested rectangles. Each level of the hierarchy is represented by a colored
rectangle (branch) containing smaller rectangles (leaves). The space inside each rectangle is
allocated based on the value that is being measured. The rectangles are arranged in size from top
left (largest) to bottom right (smallest).
• Large amounts of hierarchical data when a bar chart can't effectively handle the large number
of values.
• Proportions between each part and the whole.
• The distribution pattern of the measure across each level of categories in the hierarchy.
• Attributes, by using size and color coding.
• Spot patterns, outliers, most-important contributors, and exceptions.
Combo charts
The combo chart visualization is a combination of a column chart and a line chart that can have
one or two Y axes. The combination of the two charts into one lets you:
91
Card visualization
The card visualization displays a single value: a single data point. This type of visualization is ideal
for visualizing important statistics that you want to track on your Power BI dashboard or report,
such as total value, YTD sales, or year-over-year change.
The multi-row card visualization displays one or more data points, with one data point for each
row.
Funnel visualization
The funnel visualization displays a linear process that has sequential connected stages, where
items flow sequentially from one stage to the next.
92
Funnel charts are most often seen in business or sales contexts. For example, they are useful for
representing a workflow, such as moving from a sales lead to a prospect, through to a proposal
and sale.
• When the data is sequential and moves through at least four stages.
• When the number of items in the first stage is expected to be greater than the number of
items in the final stage.
• To calculate a potential outcome (revenue, sales, deals, and so on) by stages.
• To calculate and track conversion and retention rates.
• To reveal bottlenecks in a linear process.
93
Gauge chart
A radial gauge chart has a circular arc and displays a single value that measures progress toward a
goal or target.
The value at the end of the arc represents the defaulted maximum value, which will always be
double the actual value. To create a realistic visual, you should always specify each of the values.
You can accomplish this task by dropping the correct field that contains an amount into
the Target value, Minimum value, and Maximum value fields on the Visualization pane.
The shading in the arc represents the progress toward that target. The value inside the arc
represents the progress value. Power BI spreads all possible values evenly along the arc, from the
minimum (left-most value) to the maximum (right-most value).
Radial gauges can be used to show the progress that is being made toward a goal or target, or
they can show the health of a single measure. However, radial gauges do take up a lot of space in
comparison to the insights that they provide. It is more effective to use a pair of gauges with a
spark line so users can see the trend and know what to do about it.
Waterfall visualization
The waterfall visualization (also known as a bridge chart) shows a running total as values are
added or subtracted, which is useful in displaying a series of positive and negative changes. The
chart consists of color-coded columns, so you can quickly identify increases and decreases. The
initial and the final value columns often start on the horizontal axis, while the intermediate values
are floating columns.
94
Waterfall charts can be used to:
Scatter chart
The scatter chart visualization is effective when you are comparing large numbers of data points
without regard to time. The scatter chart has two value axes to show: one set of numerical data
along a horizontal axis and another set of numerical values along a vertical axis. The chart displays
points at the intersection of an X and Y numerical value, combining these values into single data
points. These data points might be distributed evenly or unevenly across the horizontal axis,
depending on the data. You can set the number of data points, up to a maximum of 10,000.
You might want to use a scatter chart instead of a line chart because it allows you to change the
scale of the horizontal axis. Scatter charts also allow you to:
95
• Compare large numbers of data points without regard to time. The more data that you include
in a scatter chart, the better the comparisons that you can make.
The following example shows a scatter chart that displays outliers (anomalies) with a trendline
going up. The chart clearly shows that most products were sold at the same quantity, and only
some products were sold in larger quantities. By identifying those outliers, you can run further
analysis and break them down by country and region, which can help to improve logistics,
decrease costs, and increase customer satisfaction.
Maps
Power BI integrates with Bing Maps to provide default map coordinates (a process called
geocoding), so you can create maps. Together, they use algorithms to identify the correct location;
however, sometimes, it's a best guess.
A basic map (bubble map) is used to associate categorical and quantitative information with spatial
locations. This type of map visual displays precise geographical locations of data points on a map,
as illustrated in the following image. A fill map uses shading, tinting, or patterns to display how a
value differs in proportion across a geographical region. Similarly, shape maps use colors to
display relative comparisons of geographical regions. You can also use an ArcGIS map to display
graphical information in a more interactive way.
96
Slicer visualization
The slicer visualization is a standalone chart that can be used to filter the other visuals on the
page. Slicers provide a more advanced and customized way of filtering, in comparison to
the Filters pane, which is suited to more basic filtering operations. You can learn more about these
two filtering options in another module.
Slicers come in many different formats, including list, drop-down, and buttons, and they can be
formatted to allow the selection of only one, many, or all available values.
• Visualize commonly used or important filters on the report canvas for easier access.
• Simplify your ability to see the current filtered state without having to open a drop-down list.
• Filter by columns that are unneeded and hidden in the data tables.
• Create more focused reports by putting slicers next to important visuals.
Tip
Using a slicer that is set to a drop-down format will defer the queries that are being sent to the
dataset and can help improve performance.
97
Q&A visualization
The Q&A visualization allows you to ask natural language questions and get answers in the form
of a visual. This ability to ask questions is valuable to consumers and to you, the report author.
This visualization type can help you create visuals in the report, and it can also be used as a tool
for consumers to get answers quickly.
• The question box, where users enter their question and are shown suggestions to help them
complete the question.
• A pre-populated list of suggested questions.
• An icon that users can select to convert the Q&A visual into a standard visual.
• An icon that users can select to open Q&A tooling, which allows designers to configure the
underlying natural language engine. When entering natural language queries with Power BI Q&A,
you can specify the visual type in your query. The following example illustrates how to
implement Net sales by country.
• 6 minutes
98
Power BI Desktop gives you a variety of options for customizing how your selected visualizations
look, such as the colors and format of the text that they contain. You should take time to explore
the options to determine what impact they each have on a visual.
In this example, you will format and configure the default clustered column chart visualization to
better meet the needs of your report requirements.
Start by selecting the visualization on the canvas, and then select the Format button (paint roller
icon) to display the Format pane.
The formatting options that are available will depend on the type of visualization that you
selected.
Common formatting options include the Title, Background, and Border. In the Title section, you
can add a title to the visual, if it does not have one, or edit the title, if it has one already. The aim
of the title is to clearly describe what data is being presented in the visual. You can format the title
by changing the text, text size, font, color, background, and alignment. The subsequent section
shows an example of customizing a title.
In the Background section, you can set any color or image as the background for the visual. If you
plan to use an image as a background, try to select an image that won't have lines or shapes that
would make it difficult for the user to read the data. It is best to keep a white background so the
presented data can be clearly seen. The subsequent section shows an example of customizing a
background.
99
In the Border section, you can set a border around the visual to isolate the visual from other
elements on the canvas, which helps make it easier for the user to read and understand the data.
You can change the border color and radius to be consistent with your color scheme.
If a General section is available, you'll be able to set the precise size and place for your visual on
your canvas. This option might be suitable if the drag-and-drop feature is not placing the visual
exactly where you want it to be. It can also be useful to ensure that you have aligned specific
visuals consistently.
You might also be able to format the colors and labels for specific data values. In the Data
colors section, you can set the colors that you want to use for the data values in the visual. You
can use different colors for different fields, but always try to be consistent when it comes to
selecting those colors. It is best to use the same color scheme throughout the report. In the Data
labels section, you can change fonts, size, and colors for all labels in the visual. Try to use solid
colors so the labels are clearly visible. For example, if the background is white, use a black or dark
grey color to display your labels.
The Tooltips section allows you to add a customized tooltip that appears when you hover over
the visual, based on report pages that you create in Power BI Desktop. Tooltips is a great feature
because it provides more contextual information and detail to data points on a visual. The default
tooltip displays the data point's value and category, but your custom tooltips can include visuals,
images, and any other collection of items that you create in the report page. The subsequent
section shows an example of customizing a tooltip.
As you make changes in the Format pane, notice that the visualization updates immediately to
reflect those changes. If you need to revert the changes that you make, select the Revert to
default option at the bottom of each section in the Format pane.
In the following examples, you will edit the title, change the background, and add a tooltip.
Title
You can edit a default title and add a title, if you don't have one. In this example, you will select
the column chart visualization and then, in the Format pane, scroll down and expand
the Title section. Edit the current title by changing it to Total Sales by Country, and then increase
the font size to 16 points.
100
Background
It is best practice to keep the default white background so the presented data can be clearly seen.
However, you can change the default background color to make a visualization more colorful and
easier to read or to match a particular color scheme. In this example, continue with the column
101
chart that is selected and then, in the Format pane, expand the Background section and change
the color to light grey.
Tooltip
Using tooltips is a clever way of providing more contextual information and detail to data points
on a visual. When you add a visual, the default tooltip displays the data point's value and category,
but you can customize this information to suit your needs. For example, you might want to
provide your report users with additional context and information, or specify additional data
points that you want users to see when they hover over the visual.
To expand on the data points that are displayed in the default tooltip, you can drag a field from
the Fields panel into the Tooltips bucket. However, you should not add many more fields to the
tooltips because adding too many fields can introduce performance issues and slow down your
visuals.
The following image shows the default tooltip first and then the customized tooltip that displays
additional data.
102
Another way to use tooltips is to display graphical information. The process of adding this type of
tooltip is not as straightforward, but it is worthwhile. You would begin by creating a new page in
the report.
Open the new page and then open the Format pane. Expand the Page Size section and then
select Tooltip from the Type list.
103
In the Page information section, turn the Tooltip slider to On so that Power BI registers this page
as a tooltip page
Tooltips have limited canvas space, so to ensure that your visuals appear in the tooltip, on
the View tab, set the Page view option to Actual size.
104
Next, add one or more visuals to the tooltip page, in the same way that you would on any other
report page.
Now, you need to specify the fields for which you want the tooltip to display. Select the tooltip
page and then select the Values tab in the Visualizations pane. Drag the fields from
the Fields pane into the Tooltip bucket. In this example, you will drag the SalesAmount field into
the Tooltip bucket.
Return to the report page and apply the tooltip to one or more visuals on that page. Select a
visual and then, in the Format pane, scroll down to the Tooltip section. Turn the tooltip
option On and then select your tooltip page from the Page list.
When you hover over the visual, the tooltip will display.
105
Import a custom visual
In addition to the out-of-the-box visualizations in Power BI Desktop, hundreds of other developers
have created a multitude of visuals for you to choose from. If you have a specific visual in mind,
you can likely find it in the marketplace. If you can't find it, Power BI makes it possible for you to
build your own.
The custom visuals that are available in Microsoft AppSource are created by Microsoft and
Microsoft partners. Some of these custom visuals are certified and some are not. The certified
status means that the visual meets the Microsoft Power BI team code requirements; the visual is
tested to verify that it doesn't access external services or resources and that it follows secure
coding patterns and guidelines. The certification process is optional, so an uncertified visual is not
necessarily unsafe to use.
Note
Some organizations prefer not to use custom visuals for security or other reasons. Before you
import custom visuals, check with your organization to see whether custom visuals are allowed or
not. If they are not allowed, you can still create reports in Power BI Desktop with them, but they
will not render in Power BI service.
If you want to create your own custom visual, you can use the custom visual software
development kit (SDK), which is an open-source tool based on NodeJS (JavaScript programming
language) that is available on GitHub. The custom visual is packaged as a single Power BI Visual
Tools (.pbiviz) file that you can import into Power BI Desktop.
Creating a custom visual is beyond the scope of this unit, so in this example, you will import a
custom visual from AppSource.
106
In the Visualizations pane, select the Get more visuals icon and then select Get more visuals. On
the window that displays, locate and select the visual that you want to import and then select Add.
The new visual will appear under the other visuals in the Visualizations pane. To add the visual to
your report, select its icon. You can then add fields to the visual and customize its formatting, just
like you would for any other visual.
107
Add an R or Python visual
If you use the R or Python programming language, you can use them to visualize your data within
Power BI Desktop. Power BI Desktop has an out-of-the-box visualization option for both R and
Python that you can access on the Visualizations pane, and the process for creating these visuals
is almost the same. You can also import a custom R or Python visual from Microsoft AppSource.
Note
If you decide to use an R or Python visual, and you want to refresh the data in Power BI service,
you'll need to use a personal gateway. For more information, see Use personal gateways in
Power BI.
Create an R visual
Before you create the R visual, you must install R on your local computer so that Power BI Desktop
can run R scripts. You can download and install R for free from many locations, including
the Microsoft R Application Network and the CRAN Repository.
When you have downloaded and installed R, Power BI enables it automatically, but you should
verify that it has been enabled in the correct location. In Power BI Desktop, select File > Options
and settings > Options and then select R scripting in the Global options list. Verify that your
local R installation is specified in the Detected R home directories drop-down menu and that it
properly reflects the local R installation that you want Power BI Desktop to use. In the following
image, the path to the local installation of R is C:\Program Files\R Open\R-3.5.3.
108
When you've verified your R installation, you can create the R visual.
Select the R visual icon in the Visualizations pane and then select Enable on the window that
displays. You'll then see a placeholder R visual image on the report canvas, with the R script
editor underneath.
109
Next, in the Field panel, select the fields that you want to use in your script. They will display in
the Values section in the Visualizations pane. You'll use the data in these fields to create a plot.
As you select or remove fields, supporting code in the R script editor is automatically generated
or removed. Based on your selections, the R script editor generates the following binding code:
110
• The editor created a dataset dataframe with the fields that you added.
• The default aggregation is: do not summarize.
• Similar to table visuals, fields are grouped and duplicate rows appear only once.
When you have selected the fields, you're ready to write an R script that results in plotting to the R
default device. When the script is complete, select Run from the R script editor title bar.
No prerequisites exist for creating a Python visual, so you can start right away in Power BI Desktop
by selecting the Python visual icon in the Visualizations pane. Select Enable on the window that
displays, and then you'll then see a placeholder Python visual image on the report canvas, with
the Python script editor underneath.
111
You can continue creating a Python visual in the same way as you did when creating the R visual.
In summary, you would select the fields, write the Python script, and then select Run from
the Python script editor title bar.
To import an R or Python visual from AppSource, in the Visualizations pane, select the Get more
visuals icon and then select Get more visuals. On the window that displays, locate and select the
R or Python visual that you want to import and then select Add.
112
Work with key performance indicators
Key performance indicators (KPIs) are excellent in helping you track progress toward a specific
goal over time. To use a KPI, you need three pieces of information:
• A unit of measurement that you want to track, for instance total sales, number of employee
hires, number of loans serviced, or number of students enrolled.
• A goal for the measurement so that you can compare your progress with that goal.
• A time series, for instance daily, monthly, or yearly.
Start by adding the KPI visual to the design service. The following screenshot shows the KPI icon in
the Visualizations pane.
113
When configuring the KPI visual, enter the unit of measurement that you are tracking in
the Indicator prompt. Then, enter the goal under Target goals and select the time series from
the Trend axis drop-down list, as shown in the following screenshot.
This action will produce a KPI that looks similar to the following screenshot.
114
KPIs work best in a series, for instance, showing the daily, monthly, and yearly goals in the section
of a Power BI report.
Introduction to analytics
Analytics encompasses emerging industry practices, such as data mining, big data analytics,
machine learning, AI, and predictive analytics. It is a term that is used to describe the technical
aspects of analytics that have predictive capabilities and can be used to solve business problems.
Analytics can transform raw data into an extensive collection of information that categorizes data
to identify and analyze behavioral data and patterns. Organizations can use this information to
analyze the current state of their operations and to predict future behavior and trends by asking
"what-if" questions. Additionally, analytics can help with fraud detection, image recognition,
sentiment analysis, overall general employee productivity, and it also often replaces cumbersome
manual processes.
115
Consider the scenario where you ask an employee to determine the cause of a recent spike in
sales. The employee might have to painstakingly inspect each sale, interview customers, talk to
sales people, and examine market trends. Instead, you can use the Microsoft Power BI key
influencers visual to use advanced analytics and possibly get an answer much faster. The visual is
only as good as the data that you give it, so you'll still have to collect the data and organize it. The
actual analytics, however, can be done for you or at least give you an excellent start.
By reducing manual work, advanced analytics is ultimately able to help organizations make better
business decisions and create actionable and meaningful results.
Traditionally, data analysis was a complex task that was carried out by engineers. Today, data
analysis is more accessible to, and understood by, many people within organizations, across all
teams. Power BI is an exceptional tool for quickly pulling actionable insights from data. It allows
you to build visuals and metrics for your data in reports and dashboards so that you and your
users can analyze data insights at a high level and drill down into those insights for more detailed
information.
In this module's scenario, you work for Tailwind Traders as a data analyst. You've been tasked with
building reports and dashboards that will be used across the organization to help with crucial
business decisions. For example, the Product team is interested in learning if specific products are
not selling as well as others, the Sales team is focused on sales forecasts for the coming year, and
the Warehouse team is interested in a general breakdown of how the warehousing and shipping
locations are performing worldwide. For each of these teams, you have to build and share unique
reports and dashboards that display high-level insights and visuals that are developed by using
advanced analytics.
The inherent functionality of Power BI will help you accomplish this task. You can develop quick
insights and share them in reports and dashboards with different teams within the organization.
The advanced analytics capabilities of Power BI will enable you to identify categories and trends,
see how data changes over time, and much more. From this information, you can make predictive
data models and, therefore, help your organization make more robust business decisions, plans,
and forecasts.
This module outlines the advanced analytic capabilities of Power BI. By the end of this module, you
will be able to:
116
• Apply AI Insights.
The statistical summary is the information that provides a quick and simple description of your
data. Power BI has many functions that help you to conduct a statistical analysis, such as Data
Analysis Expressions (DAX) functions, visuals such as histograms and bell curves, advanced
analytics visuals, and statistical programming languages such as Python and R.
Exploring the statistical summary gives the user a high-level view of the available data, where they
can see clusters, patterns on behavioral data, data averages, and more. They can gain insights
about their data that will help drive business decisions.
For example, the Supply Chain team asks you to create a report that shows the frequency of
orders for certain products and what the top 10 products are in terms of sales.
Statistical functions
Power BI Desktop has a number of DAX functions that you can use to get quick statistics based on
your data. You can access these quick functions by right-clicking the Values field in
the Visualizations pane, as illustrated in the following image.
117
However, to avoid performance issues, it's better to create the statistical measures yourself by
using DAX functions to calculate average, sum, min, max, and so on. For example, to analyze the
inventory data to find the average order quantity for each product, you could use the following
formula:
DAXCopy
Average Qty =
AVERAGE ( Sales[Order Qty] )
Histogram
Histograms and bell curves are the most common way to display statistics about your datasets. In
Power BI terms, you can represent a histogram with one of the bar or column chart visuals and
represent a bell curve with an area chart visual, as illustrated in the following image. You can also
use the Q&A visual to ask a direct question about the top or bottom items in a list.
118
A typical bar or column chart visual in Power BI relates two data points: a measure and a
dimension. A histogram differs slightly from a standard bar chart in that it only visualizes a single
data point.
In this example, you use the clustered column chart visual to present a histogram that determines
the order quantities by order sizes.
You start by selecting the clustered column chart icon on the Visualization pane. Next, create a
new grouping for the x-axis. You will learn more about grouping and binning later in this module,
but they are useful in this context also.
To create the group, in the Fields pane, right-click the data field that you want to analyze and then
select New Group. In this case, you use the OrderQty field. In the Groups window that displays,
set up the bin group as follows:
119
Next, populate the visual as follows:
1. Drag and drop the OrderQty field from the Fields pane into the Value field on
the Visualizations pane.
2. Drag and drop the Order Bins (Buckets) group from the Fields pane into
the Axis field on the Visualizations pane.
The visual now shows that the data is grouped into buckets on the x-axis, with the order quantities
of that variable on the y-axis.
You have now produced a histogram that displays the order quantity (OrderQty field) by order
size buckets for the Supply Chain team.
120
Top N analysis
The TOPN DAX function returns the top N rows of a specified table. The Top N analysis is a great
way to present data that might be important, such as the top 10 selling products, top 10
performers in an organization, or top 10 customers. Alternatively, you can look at it from the other
perspective and present the bottom 10 items in a list, in other words, the worst performers.
Depending on the requirements, you might want to use one or both of these options.
In this example, the Supply Chain team wants to know what the top 10 selling products are. You
accomplish this task in one of three ways: by using a Q&A visual, using a Top N filter, or writing a
DAX formula.
You've created a report for the Supply Chain team, and now the team members have questions
about various other views or insights that they are interested in. Power BI has a built-in Q&A visual
that allows users to ask their own questions and get answers so you don't have to address each
individual question. The Q&A visual is an effective tool because it allows users to quickly get
answers about the data independently, which saves time for everyone involved. The Q&A visual is
unique in that it does not require knowledge of Power BI to use the visual; users can ask their
question and they, too, can create insightful visuals.
Add the Q&A visualization to your report, and then reposition the visual and customize its
formatting, as required.
Now, you can use the visual to get answers. In this case, you want to know what the top 10 selling
products are, so you enter a question such as, "What are my top 10 products by sales?" Power BI
will automatically display those results for you.
121
Use a Top N filter type
Top N is a filtering option that is available on the Filters pane. Select the field that you want to
analyze on your report page (in this example, it's the Product Name field). In the Filters pane,
expand the Filter type list and select Top N. In the Show items settings, select Top and 10. Then,
select Cost of Sales as the value that you want to filter the field by. The visual updates
accordingly.
122
Use a TOPN DAX function
You can also calculate your top 10 products in DAX by using the TOPN function. This option could
be useful if you want to present the top 10 in a different context, such as how much of the top 10
best-selling products contributed toward the overall total sales.
Start by creating a new measure called Top 10 Products. Then, use the TOPN function, along with
the SUMX function, to calculate your top 10 products by total sales, as follows:
DAXCopy
Top 10 Products =
SUMX ( TOPN ( 10, Product, Product[Total Sales]), [Total Sales] )
The following image shows the top 10 products versus total sales for comparison.
You can adjust the DAX formula to present the same result in percentages.
For more information about the statistical capabilities of Power BI, see Statistical Functions - DAX.
• 3 minutes
An outlier is a type of anomaly in your data, something that you didn't expect or that surprised
you, based on historical averages or results. You will want to identify outliers to isolate data points
that significantly differ from other data points, and then take action to investigate the reasons for
123
the differences. The results of this analysis can make a significant impact on business decision
making.
Consider the scenario where you are analyzing data for a shipping warehouse. You notice that the
number of orders increased above average for a specific product category. You first want to
identify the product category. Then, you want to ask several questions about the outlier:
Power BI allows you to identify outliers in your data, but you need to first determine the logic
behind what constitutes an outlier. You can use trigger points, such as calculations, around what
you would consider the outlier to be.
The process of identifying outliers involves segmenting your data into two groups: one group is
the outlier data and the other group is not. You could use calculated columns to identify outliers,
but the results would be static until you refresh the data. A better way to identify outliers is to use
a visualization or DAX formula because these methods will ensure that your results are dynamic.
When you have identified the outliers in your data, you can then use slicers or filters to highlight
those outliers. Additionally, you can add a legend to your visuals so that the outliers can be
identified among the other data. You can then drill in to the outlier data for more detailed analysis.
The best visual to use for identifying outliers is the scatter chart, which shows the relationship
between two numerical values. Scatter charts display patterns in large sets of data and are,
therefore, ideal for displaying outliers.
When you add a scatter chart to your Power BI report, you put your fields of interest in the X
Axis and Y Axis sections, respectively. In this case, the Orders Shipped field is on the x-axis, and
the Qty Orders field is on the y-axis.
124
The visual will update to display the data according to the selected fields, and you'll be able to
clearly identify the outliers in that data; they are the isolated items that are away from the bulk of
the data.
125
Now that you can identify the outliers in your data, you can investigate the reasons for their
existence and take corrective action.
You can use DAX to create a measure that will identify the outliers in your data, such as in the
following formula:
DAXCopy
Outliers =
CALCULATE (
[Order Qty],
FILTER (
VALUES ( Product[Product Name] ),
COUNTROWS ( FILTER ( Sales, [Order Qty] >= [Min Qty] ) ) > 0
)
)
Order Qty is a measure in the Sales table, and Min Qty refers to the lowest order quantity in the
Sales table
When you have created a new outlier measure, you can group your products into categories by
using the grouping feature, as you previously did when creating a histogram. You then need to
add a scatter chart visual, as you did in the previous section, because this is the best visualization
option for displaying outliers. When you've added the scatter chart, populate it with the fields that
are associated with your DAX formula and outlier measure.
126
In the scatter chart, you'll be able to identify the outliers in your data. You can then investigate the
reasons for their existence and take corrective action.
Grouping is used for categories of data. Binning is similar to grouping, but it is used for grouping
continuous fields, such as numbers and dates.
You can use the grouping and binning features to ensure that the visuals in your reports display
your data according to your preference. Using these features will help you to clearly view, analyze,
and explore the data and trends in your visuals. Additionally, you'll be able to identify clusters,
patterns of behavior, data averages, and more. The results of this analysis will provide your users
with more specific insights on their data, which can help drive business decisions.
In this example, the Customer Service team has returned to you, greatly impressed by the analysis
that you have done. Now, they want you to further analyze their Help ticket data, asking if you can
127
segment the data into different groups and clusters. In particular, they want to identify the cities
with the highest sales.
Create a group
The following image shows a bar chart in which Power BI has automatically segmented the data in
the way that it found most useful: Total Sales by State. However, you want to group some of the
bars (states) together so that you can view them as one category, which will help the Sales team
identify the cities with the highest sales.
To create the group, use Ctrl + click to select the data points on the visual that you want to
group. In this case, it's states with sales greater than 500,000 dollars. Right-click one of those
selected data points and then select the Group data option.
When the group is created, notice that the visual updates to take into account the new group. The
following image shows that the other states, which are the states with lower sales (less than
500,000 dollars) have been grouped together and are highlighted in a different shade.
128
The new group field displays in the Legend bucket for the visual and is listed in the Fields pane.
When you create a group, you can change the way that the data is displayed in the visual. For
example, you might want to switch the values in each axis. You can also use the group in any of
the other visuals in your report. To do so, drag the group field from the Fields pane and then drop
it into the visual in which you want to use it.
Edit a group
Continuing with the previous example, you now want to edit the categories that make up your
group. Right-click the group field in either the Legend bucket or the Fields pane, and then
select Edit Groups.
In the Groups window that displays is a list of the groups and the different items within those
groups. The following image shows the States with Sales > 500k group and its members, along
with the Other group (States with Sales < 500k) that contains all other values that have not been
put into the first group. If you refresh your data, and new items appear in the ungrouped values
list, they'll all go into the Other group.
129
You can now make changes to the group. You can rename any group by double-clicking the
group title in the Groups and members section and entering a new name. You can add
ungrouped values into an existing group, remove values from an existing group, and create a new
group.
The process of binning allows you to group your numerical and time field data into "bins" of equal
size. This approach allows you to visualize and identify trends in your data in more meaningful
ways. Binning allows you to right-size the data that Power BI Desktop displays.
In this example, you want to create bins (groups) for the Order Qty field. Start in the Fields pane
by right-clicking the Order Qty field that you want to create the bins for, and then select New
Group. On the Groups window that displays, set the Bin size to the size that you want, adjust
other settings as required, and then select OK.
130
When you have set up the bin group, you'll see a new field in the Fields pane
with (bins) appended to its name. You can then drag that field onto the canvas to use the bin size
in a visual.
The Power BI clustering feature allows you to quickly find groups of similar data points in a subset
of your data. It analyzes your dataset to identify similarities and dissimilarities in the attribute
values, and then it separates the data that has similarities into a subset of the data. These subsets
of data are referred to as clusters.
For example, you might want to look for patterns in your sales data, such as the behavior of
customers overall. You can segment the customers into clusters according to their similarities, such
as age or location.
Start by adding the scatter chart visualization to your report and then add the required fields to
the visual. In this example, you will add the Order Qty field to the x-axis, the Sales field to the y-
axis and Unit Price to the Values field. The following image shows considerable data in the scatter
chart, so it is difficult to discern any natural groups.
131
To apply clustering to your scatter chart, select More options (...) in the upper-right corner of the
visual and then select Automatically find clusters.
On the Clusters window that displays, you can edit the default name, field, and description, if
required. However, for this example, you want to change the number of clusters. The following
image shows that the Number of clusters box is blank by default, which means that Power BI
automatically finds the number of clusters that it determines as making the most sense with your
data.
Enter the number of clusters that you want (3) into the box and then select OK. Power BI will run
the clustering algorithm and create a new categorical field with the different cluster groups in it.
132
Now, when you look at the visual, you can clearly see the clusters that are in your data and
proceed to perform analysis on them.
The new cluster field is added to your scatter chart's Legend field well bucket, which you can now
use as a source of cross-highlighting like any other Legend field. You can also find the new cluster
field in your field list and use it in new visuals, just like any other field.
If you want to edit the cluster, right-click the cluster field and select Edit clusters.
133
In the preceding example, when you applied clustering to the scatter chart, you could only use two
measures. If you want to find clusters by using more than two measures, you can use a table visual
instead, add all the fields you want to use, and then run the clustering algorithm by using the
same process.
Time series analysis involves analyzing a series of data in time order to identify meaningful
information and trends and make predictions. The result of time series analysis is the best data
that you can use for forecasting activities.
Time series analysis often involves the use of visuals such as Gantt charts, project planning, and
stock movement datasets. In Power BI, you can use visuals to view how your data is progressing
over time, which in turn allows you to make observations, such as if any major events disrupted
your data.
134
To conduct a time series analysis in Power BI, you need to use a visualization type that is suitable
for displaying trends and changes over time, such as a line chart, area chart, or scatter chart. You
can also import a time series custom visual into Power BI Desktop from Microsoft AppSource. The
following example uses a standard scatter chart.
In addition to the range of time series custom visuals, Microsoft AppSource has an animation
custom visual called Play Axis that works like a dynamic slicer and is a compelling way to display
time trends and patterns in your data without user interaction. This visual is similar to the one that
Hans Rosling used in his original presentation and is used alongside the scatter chart in the
following example.
Note
Some organizations prefer not to use custom visuals for security or other reasons. Before you
import custom visuals, check with your organization to see if they are allowed or not. If they are
not allowed, you can instead use the Play Axis visual that is available for scatter chart
visualizations within Power BI Desktop because it has similar functionality.
In this example, you are developing a Sales report. The Sales team wants to study the quarterly
sales trends and identify which models sell better, depending on the time of the season. You
decide to use two visuals, a scatter chart and line chart, for the purpose of time series analysis, and
then enhance those visuals with animation so the Sales team can see how the sales data changes
over time.
You start by adding your visuals to the report page to show the sales data.
135
Next, you will import the animation custom visual to use with the visuals. In
the Visualizations pane, select the Get more visuals icon and then select Get more visuals. On
the Power BI Visuals window that displays, search for play axis, and then select the Add button
for the Play Axis (Dynamic Slicer) visual.
A message will display, stating that the visual was successfully imported. When you return to
Power BI Desktop, you'll see the new Play Axis icon in the Visualizations pane. Select the page,
and then select the Play Axis icon to add that visual to the page.
With the new visual selected, select the field (Quarter) that you want to use as the slicer in
the Play Axis animation. Animation controls become available on the visual.
136
You can now resize and reposition the new visual and customize its formatting so that it's
consistent with the other visuals on the page. Specific formatting options that you might want to
use include:
• In the Animation Settings section, you can control the play functionality of the Play
Axis visual, such as making the animation automatically start, continue looping, and then
change the speed at which the animation occurs.
• In the Colors section, you can change the appearance of the Play Axis visual by adjusting its
overall color, or selecting the Show all option, and then changing the color of each control
button.
• The Enable Caption On section allows you to turn on/off the text that is displayed next to the
visual or adjust the formatting of it.
137
When you have set up the Play Axis visual to meet your requirements, you are ready to use it with
your other visuals. Select the Play button and then watch how the data in each visual on the page
evolves over the time. You can use the control buttons to pause the animation, restart it, and so
on.
Note
This feature does not work if you have non-numeric filters applied to your visual and/or if you
have measure filters applied.
In this example, you are developing a report for the Customer Service team that deals with Help
tickets. They want to analyze the ticketing data that is created online when a customer asks a
question. You've created a preliminary visual to display data for tickets by location, but you're now
curious about why the distribution of your data looks the way that it does.
Instead of exploring the data manually, you can use the Analyze feature to get fast, automated,
insightful analysis of your data.
138
To use the Analyze feature, right-click a data point on the visual and then hover over
the Analyze option to display two further options: Explain the increase and Find where the
distribution is different. The options that are available will depend on the data point that you
selected.
In the example below, you select the Explain the increase option, and a window displays with a
new visual, as illustrated in the following image.
139
.
Note
140
Some organizations prefer not to use custom visuals, or only permit certain custom visuals, for
security or other reasons. Before you import custom visuals, check with your organization to see
whether they are allowed or not. If they are not allowed, you can still create reports in Power BI
Desktop with them, but they will not render in Power BI service.
Previously, you imported a custom visual from Microsoft AppSource for the purposes of time
series analysis. For this example, you'll focus on the range of Advanced Analytics custom visuals
that are available. These custom visuals include box-and-whisker plots, variance charts, hierarchical
trees, Gantt plots, clustering plots, and much more. Using advanced analytics visuals adds a layer
of complexity to your reports and allows you to further analyze the data and develop granularity
within your visuals.
In this example, you've produced some charts and visuals for the Customer Service team, but now
they want you to create a variance chart so they can study the variance in the Help tickets. You
decide to browse Microsoft AppSource to see if an advanced analytics visual exists that you can
use to satisfy this request.
In the Visualizations pane, select the Get more visuals icon and then select Get more visuals. On
the Power BI Visuals window that displays, select the Advanced Analytics category. Browse the
available options and then select the Add button for the visual that you want to import. In this
example, you will add the Variance Chart custom visual.
When the visual has been imported, an icon for the new custom visual displays under the other
visual icons in the Visualizations pane.
141
You can then add fields to the new visual and customize it in the same way that you would for any
other visual. In this example, you will add Country to the Category field, Gross Sales to
the Primary Value field, and Net Sales to the Comparison Value field.
Then, you should notice that you have a variance visual that contains multiple charts, which is a
task that you couldn't complete without importing the Advanced Analytics custom visual from
AppSource.
142
Review Quick insights
Completed100 XP
• 10 minutes
The Quick insights feature in Power BI uses machine learning algorithms to go over your entire
dataset and produce insights (results) for you quickly. This feature is a great way to build
dashboards when you don't know where to start. It also helps you find insights you might have
missed when building your reports. From the insights that Power BI discovers, you can generate
appealing, interactive visualizations.
Note
This feature is available in the Power BI web service only. Also, this feature doesn't work with
DirectQuery; it only works with data that is imported to Power BI.
Consider the scenario where one of the datasets that you've been given contains substantial data
concerning the Help tickets that were created for the Customer Service team. Because of the
143
extensive data, you don't know where to begin analyzing, so you decide to let Power BI do it for
you.
To get quick insights on your dataset, open your Power BI web service and then select
the Content tab. Locate your report for which you want to get quick insights, which in this case
is TailwindTraders. Then, select More options (...) > Quick insights.
Power BI will use various algorithms to search for trends in your dataset. This process might take a
few seconds, but when it is finished, you'll see a message in the upper-right corner letting you
know that the results are ready to be viewed.
Select View insights to open the Quick Insights page for the selected dataset, and then view the
insights that Power BI has found for you. The Quick Insights page contains up to 32 separate
insight cards, and each card has a chart or graph plus a short description. In this example, one of
the insights is a card that displays a visual for Count of Product by Category Name, as illustrated
in the following image.
144
Add a Quick insights result card to a dashboard
If you see an insight card that is particularly compelling, you can add it to your dashboard. On
the Quick Insights page, hover over the card, then select the pin icon. The visual is added to your
dashboard, where you can reposition it as required.
To take a closer look at a particular insight card on the Quick Insights page, select an insight card
to open. The insight screen opens in Focus mode.
145
You can then perform the following actions:
• Filter the visualization by using the available options in the Filters panel.
• Pin the insight card to a dashboard by selecting Pin visual.
• Run insights on the card (scoped insights) by selecting Get insights in the upper-right corner.
The scoped insights allow you to drill into your data.
• Return to the original insights canvas by selecting Exit Focus mode in the upper-left corner.
Apply AI Insights
The AI Insights feature allows you to connect to a collection of pretrained machine learning
models that you can apply to your data to enhance your data preparation efforts.
Continuing with the previous example, you now want to add text analytics to the content of
the Comments field in the ticketing data. This process will help you see if you can determine the
sentiment of the customers that are featured in the Help tickets. You can use the AI
Insights feature to accomplish that task.
To apply the AI Insights feature to your data, open Power Query Editor and select the Add
Column tab. Three AI Insights options will be available for you to choose from: Text
Analytics, Vision, and Azure Machine Learning.
Note
Premium capacity is required to use the Text Analytics and Vision options.
146
Note
If you do not see these options, you need to enable the AI Insights feature in Power BI Desktop
settings. Go to File > Options and settings > Options. In the Global options list, select Preview
features, select the check box for the AI Insights function browser option, and then select OK.
147
On the Add column tab, the most relevant AI Insights option for this example is Text Analytics.
This option includes Azure Cognitive Services models, such as Sentiment Analysis, Key Phrase
Extraction, and Language Detection, that derive meaning or specific pieces of language from text
data. You can use either the Sentiment Analysis or Key Phrase Extraction option to determine the
customer sentiments in the Help tickets and visually show the results in Power BI.
Introduction
You've likely had the chance to load and transform data from numerous sources, build visuals,
create DAX equations, and even publish a report or two to Microsoft Power BI. The next step on
your data analysis journey is to share these reports with your wider audiences and organizations.
You can accomplish this task in a workspace, which is a feature of Power BI. A workspace is a
centralized repository in which you can collaborate with colleagues and teams to create collections
of reports and dashboards.
• Focused collaboration efforts. You can use workspaces to house reports and dashboards for
use by multiple teams.
• Ability to share and present reports and dashboards in a single environment.
• Assurance that the highest level of security is maintained by controlling who can access
datasets, reports, and dashboards.
This module will discuss several tasks that are focused on helping you to create and manage a
workspace in Power BI. Additionally, you will learn about importing and updating assets in a
workspace, configuring data protection, troubleshooting data, and much more.
Create a workspace
1. Go to Power BI service.
2. Select the Workspaces drop-down menu.
3. Select the Create a workspace button at the bottom of the resulting panel.
148
4. In the Create a workspace window, enter information in the Workspace
name and Description fields and then upload a Workspace image.
149
150
5. In the Advanced drop-down menu, you can create a Contact list of users who will receive
notifications if issues with the workspace occur.
By default, these users are the workspace admins, but you can also add specific users. You can also
add this workspace to a specific OneDrive and then choose whether this workspace will be a part
of a dedicated capacity or not. Dedicated capacities are Power BI Premium features that ensure
that your workspace will have its own computational resources as opposed to sharing resources
with other users.
6. After you have filled out pertinent fields on the Create a workspace window, select Save.
You can complete the process of creating a workspace by using the new workspace experience.
We recommend that you use the modern workspace experience over the classic workspace
experience, unless the classic workspace is expressly needed.
Now that you've successfully created a workspace, the Sales team wants to collaborate with other
teams to build additional dashboards and reports. As the workspace owner, you want to ensure
that appropriate access is given to members of the Products team because their team includes
stakeholders and developers. Workspace roles allow you to designate who can do what within a
workspace.
• Admin
o Add/remove other users
o Publish, update, and/or share an app in a workspace
o Create, edit, delete, and publish reports and content in a workspace
o View and interact with reports and dashboards in a workspace
o Configure data refreshes
• Member
o Can add users with lower permissions
o Cannot remove users
o Cannot delete the workspace
o Cannot update the metadata about the workspace
• Contributor
o Cannot add or remove users
o Cannot publish, update, or edit an app in a workspace unless given this ability by
admins/members
o Can create, update, and publish content and reports within a workspace
o Can schedule data refreshes
151
• Viewer
o Cannot add or remove users
o Can only view a report or dashboard in a workspace
o Can read data that is stored in workspace dataflows
Note
If the workspace is backed by a Premium capacity, a non-Pro user can view content within the
workspace under the Viewer role.
To assign these roles to users, go to the workspace that you've created and, in the upper-left
corner of the ribbon, select Access.
In the resulting Access window, you can add email addresses of individual users, mail-enabled
security groups, distribution lists, Microsoft 365 groups, and regular security groups, and then
assign them to their specific roles. You can also change the user's assigned role at the bottom of
the page and delete the user from the workspace by selecting the ellipsis (...) next to their name.
152
153
Create and configure an app
After creating an app workspace and assigning your collaborator-specific roles, you want to add
content to your app workspace. Content can be in the form of reports, dashboards, datasets,
dataflows, and so on. An app is a published, read-only window into your data for mass distribution
and viewing. When ready to share apps with your users, you can publish the app. This process
requires a Power BI Pro license. Consuming and viewing an app requires a Pro license or it must be
backed by a Premium capacity.
When you have added your content to the app workspace, you can create the app. Go to your
workspace, and on the ribbon, select + New, as shown in the following screenshot. In this ribbon,
you can choose to create a new report, dataset, streaming dataset, or dataflow, to name a few.
Selecting any one of these options will generate a window where you can enter the name of the
app and select the source of the report (for example, the dataset that is used to create a report).
154
You can also select the Get Data button in the lower-left corner of the navigation bar, and then
import already-existing reports from Power BI Desktop and add them to your workspace app.
You can also configure your app and turn on the option to include the report or dashboard in the
app when you publish, as shown in the following screenshot. If you do not want to include this
report or dashboard in the app, then you can turn off this option.
155
When you are ready to publish your app with its collection of reports, dashboards, and datasets,
return to the workspace and select Create app in the upper-right corner of the ribbon.
This action retrieves the following window, where you can build your app by naming it, adding a
description, and adding an app logo or theme color, if necessary.
156
Under the Navigation tab, you can change the order in which the content is oriented for the user
by creating a custom navigation pane. For instance, you can change the name of the content,
change the link, and then add it to a specific section on the navigation pane. You can also add
content that is external to Power BI through a link. This external content can also be included
within the content area. For example, a YouTube video or PowerPoint slide deck has to be an
embed URL, not the raw URL
157
Under the Permissions tab, you can grant access to all users in your organization or choose which
users have access. You can also give your users build and share permissions, which means that
they can create and share the content in the app. The Permissions tab provides a few other
options. With Build permissions, you can allow your users to connect to underlying datasets so
that they can reuse and build their own reports by using the same dataset. Build permissions are
required if your users want to export the underlying data or build new content on top of the data.
You can also allow your users to only create a copy of the report to view in another workspace,
where they can modify and delete visuals according to their needs. You can also give your users
Share permissions so that they can share underlying datasets and reports.
158
159
After making necessary edits, you can select Publish app, and your app will be published. Then,
you will get the following screen with a link that you can share with your users.
Update workspaces
After publishing your app, you realize that you want to make updates within your workspace.
To accomplish this task, return to the workspace, and make the necessary updates in the reports
or dashboards. The workspace acts as a staging area where you can make any changes that you
want, but they will not be added to the app until you select Update app in the upper-right corner
of the ribbon (where you previously selected Publish app). Dataset and dataflow updates are
updated immediately. When you decide to update the app, you can make changes to
the Setup, Navigation, and Permissions tabs, and when ready, you can select the Update
app button.
• Focuses your efforts for improvement. If you know the areas that experience the worst
performance, you can concentrate your efforts for improvement in those areas.
• Quantifies the impact of your reports. Usage metrics help you determine your reports' success.
160
These performance and usage metrics are available features that you can use in a workspace. With
these metrics, you can view who's using your reports, what actions are being done on the reports,
and what performance issues exist.
For example, consider the continuing scenario where you work for Tailwind Traders. You've
successfully added reports to your workspace, published an app, and begun the process of
collaborating with the Products team. Commentary begins to circulate around the company about
how useful these workspaces are, resulting in more users being added to the workspace. The Sales
team knows that performance might worsen with the increased addition of users. Consequently,
the Sales team has asked you to monitor usage and performance of the workspace.
Usage metric reports are available for Power BI Pro users and can only be accessed by users with
the role types of Admin, Member, or Contributor.
To view usage metric reports, go to the pertinent workspace. Find the report or dashboard that
you want to see usage metrics for. For example, if you want to see the usage metrics report
for Sales Data, select the ellipsis (...), and then select View usage metrics report from the drop-
down menu.
161
When the usage metrics report is ready for viewing, you will receive a prompt that will direct you
to a dashboard. In the Report usage tab, you can view such details as:
• Viewers per day, Unique viewers per day (which doesn't include users who returned to the
same reports multiple times), and Shares per day charts
• Total Views, Total Viewers, and Total Shares KPI cards
• Total views and shares ranking (compares how your report is doing in comparison to other
reports in the app)
• Views by Users (details about each specific user that viewed the dashboard)
You can also filter by the distribution method of the report (for example, through sharing or from
the workspace directly) and platform type (for example, mobile or web).
162
You can also view performance metrics on the Report performance tab, as shown in the
following screenshot.
On the Report performance tab, you can view metrics such as:
• Typical opening time - How long it takes, at the fiftieth percentile, to open the report.
• Opening time trend - How the typical opening time changes over time. This metric can tell you
how the report is performing as the number of users starts to grow.
163
• Daily/7-Day Performance charts - Highlight the performance for 10, 50, and 90 percent of the
open-report actions every day and over a seven-day period.
• Filters for date, so you can see how the performance changes according to the day.
To continue with the module scenario, the Sales team at Tailwind Traders is impressed with the
reports that you have delivered, and as they continue to use the abilities of Power BI, they also
want to maintain data and report integrity without slowing development timelines. As a result,
they have asked you to create a development pipeline that will be used by all teams to develop
reports and dashboards. Power BI provides deployment pipelines that you can use to help
accelerate development and minimize errors.
The deployment pipeline feature in Power BI manages content in dashboards, reports, and
datasets between different environments in the development life cycle. With this feature, you can
develop and test Power BI content in one centralized location and streamline the process before
deploying the final content to your users. This Power BI Premium feature requires you to be a
Capacity admin.
• Increased productivity - Through this feature, you can reuse previous deployment pipelines,
ensuring that efforts aren't duplicated.
• Faster delivery of content - Report development becomes more streamlined, meaning that it
takes less time to get to production.
• Lower human intervention required - Having the ability to reuse deployment pipelines means
a decreased chance of error associated with moving content from one environment to another.
Development environments
Typically, development and collaboration occur in different stages. Reports and dashboards are
built in and iterated on a series of controlled stages, or environments, where several tasks occur:
• Development - The location in which dashboard developers or data modelers can build new
content with other developers. This stage is first in the deployment pipeline.
164
• Test - Where a small group of users and user acceptance testers can see and review new reports,
provide feedback, and test the reports with larger datasets for bugs and data inconsistencies
before it goes into production.
• Production - Where an expansive user audience can use tested reports that are reliable and
accurate. This stage is the final one of the deployment pipeline.
You can choose which one of these development environments that you want to include in your
deployment pipeline, according to your business needs. For example, you can choose to only
include the Test and Production environments, if necessary.
In the scenario with Tailwind Traders, you want to create a deployment pipeline. To configure a
deployment pipeline, go to Power BI service, and then follow these steps:
1. On the ribbon on the left side of the page, select Deployment pipelines, as shown in the
following screenshot.
165
This view shows you the steps of the development life cycle: Development, Test, and Production.
5. To create your pipeline, assign workspaces to each of these stages to facilitate where your
reports and dashboards will be housed during each stage.
6. Select Assign a workspace to begin.
7. You will be directed to the Assign the workspace to a deployment stage window, where
you can add the Tailwind Traders workspace to the Development environment.
166
Only workspaces that are assigned to a Premium capacity will appear. Additionally, you can only
assign a single workspace to each pipeline. Power BI will auto generate the two other workspaces
that are used in the pipeline.
8. If you already have Development, Test, and Production workspaces, choose one that you want to
work with and then select Assign.
167
The preceding image shows how many datasets, reports, and dashboards that you have in the
current Development environment. At every stage, you have the option to publish the associated
workspace as an app by selecting Publish app.
9. To view all objects that constitute the workspace, select Show more.
Testing stage
After you have collaborated with the teams and built a testing-ready report, you are ready to
proceed to the testing phase. Select Deploy to test, which will create a new workspace. This
workspace, by default, has the same name as the initial workspace but includes the [Test] suffix.
You can change the name by entering the workspace's settings within the deployment pipeline
interface.
Testing should emulate conditions that objects will experience after they've been deployed for
users. Therefore, Power BI allows you to change the source of data that is used during testing. To
accomplish this task, you will first need to enter the environment's deployment settings by
selecting the lightning icon, as shown in the following screenshot.
In the resulting Settings window, select the correct dataset. In this example, you want
the OrdersFigures dataset to be used for testing but with a different data source. To accomplish
this task, create parameters in Power Query Parameters (which will be discussed in a later module)
168
or add a new rule, which is the process that is used for this example. Under the Data source
rules drop-down menu, select + Add rule.
On the Data source rules section, you can change the data source (which was used in
development) to a new source, which is used for testing the reports (orders.csv in the following
example). When you are finished, select Save at the bottom of the card.
Production stage
Now, you are close to completing the pipeline, transitioning from development to testing, and
finally to production. At this stage, you need to create a data source rule for
the OrdersFigures dataset in the workspace to ensure that you are using production data. In this
instance, you will be changing your source from the test to the production folder version of the
orders.csv file, as shown in the following screenshot.
169
After performing a dataset refresh, your production workspace will be ready. You can package the
workspace as an app, which is available for users. Currently, your deployment pipeline will appear
as shown in the following figure.
You have successfully created a deployment pipeline from the development to the testing phase.
The following section describes additional operations that you can conduct in the development
pipeline.
You have created a deployment pipeline and have begun collaborating with other report
developers. You receive notification that one of the other developers has modified a report. To see
the changes to this report, select the Compare button, as shown in the following screenshot.
Selecting Compare reveals that the OrdersFigures report differs between the Development and
Test environments.
The difference is typically registered as added or removed objects. If you decide that the changes
shouldn't be deployed to the next phase, you can choose to ignore the changes. For instance, the
other developer has added a report called AdditionalOrderInfo in the Development environment,
but you don't want to deploy these changes. By selecting a specific report and then
selecting Deploy to test, you can effectively choose which reports that you want to move from
environment to environment, as shown in the following figure.
170
As the following message indicates, only one change will be carried over.
Exercise caution with this tool. Reports are dependent on their datasets. If a dataset has changed,
but you don't deploy it with an associated report, the report will not behave correctly.
We recommend that you use deployment pipelines in Power BI service. This tool ensures that the
development life cycle is streamlined and that you can create one centralized location to
collaborate, keep track of, and deploy your reports.
Consider this module's continuing scenario with Tailwind Traders as an example. Thus far, you've
developed several reports and have published them to the Tailwind workspace. However, because
you are also collaborating with the Products team, it has become increasingly difficult to track
which reports need to be refreshed and which datasets are in which report. Consequently, you
want the ability to determine which datasets need to be refreshed because you've been receiving
reports of stale data. The path of data from its source to the destination can often be a
considerable challenge, more so if you have multiple datasets.
171
The Lineage view feature can help you accomplish this task efficiently and almost effortlessly.
Data lineage
Data lineage refers to the path that data takes from the data source to the destination.
• Simplifies the troubleshooting process because you can see the path that the data takes from
source to destination and determine pain points and bottlenecks.
• Allows you to manage your workspaces and observe the impact of a single change in one
dataset to reports and dashboards.
• Saves time by simplifying your task of identifying reports and dashboards that haven't been
refreshed.
The Lineage view is only accessible to Admin, Contributor, and Member roles. Additionally, it
requires a Power BI Pro license and is only available for app workspaces. To access
the Lineage view, go to the workspace, and then select Lineage from the View drop-down menu
on the top ribbon.
When the view canvas opens, you can begin to explore this view. The following example shown an
excerpt of the data lineage for the Tailwind Sales workspace.
172
This view shows all the artifacts in your workspace. Artifacts include data sources, datasets and
dataflows, reports, and dashboards. Each card represents an artifact, and the arrows in between
these cards represent the flow of data or the relationship between different artifacts. By following
the arrows from left to right, you can observe the flow of data from the source to the destination,
which will often be a dashboard. Typically, the flow would be data sources > datasets/dataflows
> reports > dashboards.
Data sources
Each of the following cards is a data source that is used in your workspace.
173
The card tells you the type of data source (for example, Text/CSV) and the Gateway, which tells
you the source of your data. If you are connected to the data through an on-premises data
gateway, this card will tell you more information about the gateway. Additionally, if you double-
click the card, you will get more details about the data source, such as the file path and the
connection status.
174
Selecting the lower-right icon on the card will highlight the path from the data source to the
destination, as shown in the following screenshot, which clarifies the exact path that the data
takes.
Datasets/dataflows
Often, datasets and dataflows can connect to external data sources, such as SQL Server, or to
external datasets in other workspaces. The following examples show dataset and dataflow cards
on the Lineage view.
175
The Lineage view uses arrows to connect objects, such as datasets, with their data sources. On
these cards, you can see when the dataset was last refreshed, and you can refresh the dataset by
selecting the arrow icon on the lower-left corner of the card, as shown in the following screenshot.
This component is a powerful troubleshooting feature that helps ensure that your dataset
refreshes are quick and uncomplicated.
Returning to the initial quandary with Tailwind Traders, you wanted to determine if the company
had stale datasets and then quickly refresh the data. By using the Lineage view feature, you can
176
go through the different datasets in one view and then use the Refresh data button to refresh
datasets that you determine as stale.
By double-clicking on any card, you can view the metadata, such as the sensitivity, by whom it was
configured, the last refresh date, and the names and count of tables within this dataset, as shown
in the following figure.
177
178
You can also view the impact of this dataset across workspaces. By selecting the overlapping
window icon on the lower-right corner of a dataset card, you can determine the impact analysis of
the dataset.
On the Impact analysis window, you can see how many workspaces, reports, and dashboards that
this dataset is a part of and how many views that this dataset has gathered, as shown in the
following screenshot.
The bottom of the Impact Analysis window includes more detail about which specific reports and
dashboards that this dataset is part of. Additionally, you can select Notify contacts, which allows
you to notify dataset owners (or any other user) of changes in the dataset. Impact analysis is useful
because it allows you to pinpoint datasets that aren't being used or looked at.
The reports and dashboards cards have similar functionality as the data source and dataset cards.
179
Selecting a card will bring up a window in which you can view the metadata about the report or
dashboard. In this window, you can also go directly to the report or dashboard. You can also
enable or disable whether you want to include this report or dashboard within the app.
180
This card also contains useful options under the ellipsis (...), as shown in the following figure. From
this menu, you can select to analyze the report in Microsoft Excel, delete a report, create Quick
Insights, save a copy to a workspace, and more.
181
Now that you have had an in-depth look into the Lineage view in Power BI, you can commence
with cleaning up the Tailwind Traders workspace. For more information, see Data Lineage.
• Use Microsoft sensitivity labels to label dashboards, reports, datasets, and dataflows by using
the same taxonomy that is used to classify and protect files in Microsoft 365.
• Add more protection measures such as encryption and watermarks when you are exporting the
data.
• Use Microsoft Cloud App Security to monitor and investigate activities in Power BI.
To continue with the module scenario, as more reports and dashboards are increasingly added to
the Tailwind Traders workspace, the Sales team becomes concerned as they realize the urgency of
securing their data. The team is concerned about the possibility of new users exporting data
without permission. The Sales team doesn't want to roll back reports or dashboards, so they have
asked you to implement comprehensive security measures that protect data access within and
outside of Power BI. You can complete this task by configuring data protection labels in Power BI.
Before you begin, ensure that you have the appropriate licensing, as shown here.
Sensitivity labels
Sensitivity labels specify which data can be exported. These labels are configured externally to
Power BI, and Power BI allows you to quickly use them in your reports and dashboards. These
labels allow you to define and protect content, even outside of Power BI. Datasets, dataflows,
reports, and dashboards can use this mechanism, and all users in your corporation can use this
feature unless exceptions have been defined.
After you have verified your ability to add labels, go to any workspace and choose an object to
secure. For this example, you will add a sensitivity label to Sales Data by going to the workspace
and, under the ellipsis (...), selecting Settings.
182
This selection will take you to a window, where you can assign a sensitivity label to your data. For
this example, the following labels have been externally configured, so you can now apply them to
the data: None, Personal, General, Confidential, and Highly confidential. You can also go
to Microsoft 365 Security Center to define your own labels.
For example, if you want to assign a Confidential label to your Sales Data report, when you
change this label on the Settings pane, it will appear as a label on the report, as shown in the
following figure.
183
This factor is crucial when you are exporting data. Data that is exported to Microsoft Excel,
Microsoft PowerPoint, and PDF files will have sensitivity labels enforced. For instance, if you
wanted to export data from Sales Data into an Excel file, if you are an authorized user, you will see
the following Excel view when you export into Excel.
However, if you didn't have established permissions, you would be denied access to see the data.
This verification ensures that only appropriate users have access to view the data, which helps
make sure that your data is secured.
The new visual icon will appear under the other visual icons in the Visualizations pane.
184
Use smart narrative summaries in your reports to address key takeaways, to point out trends, and
to edit the language and format for a specific audience. In PowerPoint, instead of pasting a
screenshot of your report's key takeaways, you can add narratives that are updated with every
refresh. Your audience can use the summaries to understand the data, get to key points faster, and
explain the data to others.
Get started
Choose the Products tab, then select the Smart narrative icon in the Visualizations pane to
automatically generate a summary.
185
You'll see a narrative that's based on all of the visuals on the page. For example, in the sample file,
smart narratives can automatically generate a summary of the report's visuals that address
revenue, website visits, and sales. Power BI automatically analyzes trends to show that revenue and
visits have both grown. It even calculates growth, which in this case is 72 percent.
186
To generate a smart narrative of a visualization, right-click it and then select Summarize. For
example, in the sample file, try summarizing a scatter chart that shows various transactions. Power
BI analyzes the data and shows which city or region has the highest revenue per transaction and
the highest number of transactions. The smart narrative also shows the expected range of values
for these metrics. You see that most cities produce less than $45 per transaction and have fewer
than 10 transactions.
187
Edit the summary
The smart narrative summary is highly customizable. You can edit or add to the existing text by
using the text box commands. For example, you can make the text bold or change its color.
To customize the summary or add your own insights, use dynamic values. You can map text to
existing fields and measures or use natural language to define a new measure to map to text. For
example, to add information about the number of returned items in the sample file, add a value.
As you type a value name, you can choose from a list of suggestions as you do in a Q&A visual.
So, in addition to asking questions of your data in a Q&A visual, you can now create your own
calculations without even using Data Analysis Expressions (DAX).
188
You can also format dynamic values. For example, in the sample file, you can show values as
currency, specify decimal places, and choose a separator for thousands.
To format a dynamic value, select the value in the summary to see your editing options on
the Review tab. Or in the text box, next to the value that you want to edit, select the edit button.
189
You can also use the Review tab to review, delete, or reuse previously defined values. Select the
plus sign (+) to insert the value into the summary. You can also show automatically generated
values by turning on the option at the bottom of the Review tab.
Sometimes a hidden-summary symbol appears in the smart narrative. It indicates that current data
and filters produce no result for the value. A summary is empty when no insights are available. For
example, in the sample file's line chart, a summary of high and low values might be empty when
the chart's line is flat. But the summary might appear under other conditions. Hidden-summary
symbols are visible only when you try to edit a summary.
Visual interactions
A summary is dynamic. It automatically updates the generated text and dynamic values when you
cross-filter. For example, if you select electronics products in the sample file's donut chart, the rest
190
of the report is cross-filtered, and the summary is also cross-filtered to focus on the electronics
products.
In this case, the visits and revenues have different trends, so the summary text is updated to reflect
the trends. The count-of-returns value that we added is updated to $4196. Empty summaries can
be updated when you cross-filter.
You can also do more advanced filtering. For example, in the sample file, look at the visual of
trends for multiple products. If you're interested only in a trend for a certain quarter, then select
the relevant data points to update the summary for that trend.
191
There's a limit to the number of summaries that can be generated so Smart Narratives picks the
most interesting things to summarize about the visual. Smart Narratives generates up to four
summaries per visual and up to 16 per page. The summaries that are generated for a page depend
on the location and size of visuals and it avoids generating the same kind of summaries for
different visuals. Therefore summarizing just the visual can generate more summaries that aren't
present while summarizing the whole page.
• Pinning to a dashboard
• Using dynamic values and conditional formatting (for example, data bound title)
• Publish to Web
• Power BI Report Server
• On-premises Analysis Services
• Live Connection to Azure Analysis Services or SQL Server Analysis Services
• MultiDimensional Analysis Services data sources
• Key influencers visual with a categorical metric or unsummarized numerical field as 'Analyze' field from a
table:
o that contains more than one primary key
o without a primary key, and measures or aggregates as 'Explain by' fields
• Map visual with non-aggregated latitude or longitude
• Multi-row card with more than three categorical fields
• Cards with non-numeric measures
• Tables, matrices, R visuals or Python visuals, custom visuals
• Summaries of visuals whose columns are grouped by other columns and for visuals that are built on a
data group field
192
• Cross-filtering out of a visual
• Renaming dynamic values or editing automatically generated dynamic values
• Summaries of visuals that contain on-the-fly calculations like QnA arithmetic, complex measures such as
percentage of grand total and measures from extension schemas.
• Calculation groups
193