Analyzing Data With Power BI
Analyzing Data With Power BI
20778A
Analyzing Data with Power BI
MCT USE ONLY. STUDENT USE PROHIBITED
ii Analyzing Data with Power BI
Information in this document, including URL and other Internet Web site references, is subject to change
without notice. Unless otherwise noted, the example companies, organizations, products, domain names,
e-mail addresses, logos, people, places, and events depicted herein are fictitious, and no association with
any real company, organization, product, domain name, e-mail address, logo, person, place or event is
intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the
user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in
or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical,
photocopying, recording, or otherwise), or for any purpose, without the express written permission of
Microsoft Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property
rights covering subject matter in this document. Except as expressly provided in any written license
agreement from Microsoft, the furnishing of this document does not give you any license to these
patents, trademarks, copyrights, or other intellectual property.
The names of manufacturers, products, or URLs are provided for informational purposes only and
Microsoft makes no representations and warranties, either expressed, implied, or statutory, regarding
these manufacturers or the use of the products with any Microsoft technologies. The inclusion of a
manufacturer or product does not imply endorsement of Microsoft of the manufacturer or product. Links
may be provided to third party sites. Such sites are not under the control of Microsoft and Microsoft is not
responsible for the contents of any linked site or any link contained in a linked site, or any changes or
updates to such sites. Microsoft is not responsible for webcasting or any other form of transmission
received from any linked site. Microsoft is providing these links to you only as a convenience, and the
inclusion of any link does not imply endorsement of Microsoft of the site or the products contained
therein.
© 2017 Microsoft Corporation. All rights reserved.
Released: 03/2017
MCT USE ONLY. STUDENT USE PROHIBITED
MICROSOFT LICENSE TERMS
MICROSOFT INSTRUCTOR-LED COURSEWARE
These license terms are an agreement between Microsoft Corporation (or based on where you live, one of its
affiliates) and you. Please read them. They apply to your use of the content accompanying this agreement which
includes the media on which you received it, if any. These license terms also apply to Trainer Content and any
updates and supplements for the Licensed Content unless other terms accompany those items. If so, those terms
apply.
BY ACCESSING, DOWNLOADING OR USING THE LICENSED CONTENT, YOU ACCEPT THESE TERMS.
IF YOU DO NOT ACCEPT THEM, DO NOT ACCESS, DOWNLOAD OR USE THE LICENSED CONTENT.
If you comply with these license terms, you have the rights below for each license you acquire.
1. DEFINITIONS.
a. “Authorized Learning Center” means a Microsoft IT Academy Program Member, Microsoft Learning
Competency Member, or such other entity as Microsoft may designate from time to time.
b. “Authorized Training Session” means the instructor-led training class using Microsoft Instructor-Led
Courseware conducted by a Trainer at or through an Authorized Learning Center.
c. “Classroom Device” means one (1) dedicated, secure computer that an Authorized Learning Center owns
or controls that is located at an Authorized Learning Center’s training facilities that meets or exceeds the
hardware level specified for the particular Microsoft Instructor-Led Courseware.
d. “End User” means an individual who is (i) duly enrolled in and attending an Authorized Training Session
or Private Training Session, (ii) an employee of a MPN Member, or (iii) a Microsoft full-time employee.
e. “Licensed Content” means the content accompanying this agreement which may include the Microsoft
Instructor-Led Courseware or Trainer Content.
f. “Microsoft Certified Trainer” or “MCT” means an individual who is (i) engaged to teach a training session
to End Users on behalf of an Authorized Learning Center or MPN Member, and (ii) currently certified as a
Microsoft Certified Trainer under the Microsoft Certification Program.
g. “Microsoft Instructor-Led Courseware” means the Microsoft-branded instructor-led training course that
educates IT professionals and developers on Microsoft technologies. A Microsoft Instructor-Led
Courseware title may be branded as MOC, Microsoft Dynamics or Microsoft Business Group courseware.
h. “Microsoft IT Academy Program Member” means an active member of the Microsoft IT Academy
Program.
i. “Microsoft Learning Competency Member” means an active member of the Microsoft Partner Network
program in good standing that currently holds the Learning Competency status.
j. “MOC” means the “Official Microsoft Learning Product” instructor-led courseware known as Microsoft
Official Course that educates IT professionals and developers on Microsoft technologies.
k. “MPN Member” means an active Microsoft Partner Network program member in good standing.
MCT USE ONLY. STUDENT USE PROHIBITED
l. “Personal Device” means one (1) personal computer, device, workstation or other digital electronic device
that you personally own or control that meets or exceeds the hardware level specified for the particular
Microsoft Instructor-Led Courseware.
m. “Private Training Session” means the instructor-led training classes provided by MPN Members for
corporate customers to teach a predefined learning objective using Microsoft Instructor-Led Courseware.
These classes are not advertised or promoted to the general public and class attendance is restricted to
individuals employed by or contracted by the corporate customer.
n. “Trainer” means (i) an academically accredited educator engaged by a Microsoft IT Academy Program
Member to teach an Authorized Training Session, and/or (ii) a MCT.
o. “Trainer Content” means the trainer version of the Microsoft Instructor-Led Courseware and additional
supplemental content designated solely for Trainers’ use to teach a training session using the Microsoft
Instructor-Led Courseware. Trainer Content may include Microsoft PowerPoint presentations, trainer
preparation guide, train the trainer materials, Microsoft One Note packs, classroom setup guide and Pre-
release course feedback form. To clarify, Trainer Content does not include any software, virtual hard
disks or virtual machines.
2. USE RIGHTS. The Licensed Content is licensed not sold. The Licensed Content is licensed on a one copy
per user basis, such that you must acquire a license for each individual that accesses or uses the Licensed
Content.
2.1 Below are five separate sets of use rights. Only one set of rights apply to you.
2.2 Separation of Components. The Licensed Content is licensed as a single unit and you may not
separate their components and install them on different devices.
2.3 Redistribution of Licensed Content. Except as expressly provided in the use rights above, you may
not distribute any Licensed Content or any portion thereof (including any permitted modifications) to any
third parties without the express written permission of Microsoft.
2.4 Third Party Notices. The Licensed Content may include third party code tent that Microsoft, not the
third party, licenses to you under this agreement. Notices, if any, for the third party code ntent are included
for your information only.
2.5 Additional Terms. Some Licensed Content may contain components with additional terms,
conditions, and licenses regarding its use. Any non-conflicting terms in those conditions and licenses also
apply to your use of that respective component and supplements the terms described in this agreement.
a. Pre-Release Licensed Content. This Licensed Content subject matter is on the Pre-release version of
the Microsoft technology. The technology may not work the way a final version of the technology will
and we may change the technology for the final version. We also may not release a final version.
Licensed Content based on the final version of the technology may not contain the same information as
the Licensed Content based on the Pre-release version. Microsoft is under no obligation to provide you
with any further content, including any Licensed Content based on the final version of the technology.
b. Feedback. If you agree to give feedback about the Licensed Content to Microsoft, either directly or
through its third party designee, you give to Microsoft without charge, the right to use, share and
commercialize your feedback in any way and for any purpose. You also give to third parties, without
charge, any patent rights needed for their products, technologies and services to use or interface with
any specific parts of a Microsoft technology, Microsoft product, or service that includes the feedback.
You will not give feedback that is subject to a license that requires Microsoft to license its technology,
technologies, or products to third parties because we include your feedback in them. These rights
survive this agreement.
c. Pre-release Term. If you are an Microsoft IT Academy Program Member, Microsoft Learning
Competency Member, MPN Member or Trainer, you will cease using all copies of the Licensed Content on
the Pre-release technology upon (i) the date which Microsoft informs you is the end date for using the
Licensed Content on the Pre-release technology, or (ii) sixty (60) days after the commercial release of the
technology that is the subject of the Licensed Content, whichever is earliest (“Pre-release term”).
Upon expiration or termination of the Pre-release term, you will irretrievably delete and destroy all copies
of the Licensed Content in your possession or under your control.
MCT USE ONLY. STUDENT USE PROHIBITED
4. SCOPE OF LICENSE. The Licensed Content is licensed, not sold. This agreement only gives you some
rights to use the Licensed Content. Microsoft reserves all other rights. Unless applicable law gives you more
rights despite this limitation, you may use the Licensed Content only as expressly permitted in this
agreement. In doing so, you must comply with any technical limitations in the Licensed Content that only
allows you to use it in certain ways. Except as expressly permitted in this agreement, you may not:
• access or allow any individual to access the Licensed Content if they have not acquired a valid license
for the Licensed Content,
• alter, remove or obscure any copyright or other protective notices (including watermarks), branding
or identifications contained in the Licensed Content,
• modify or create a derivative work of any Licensed Content,
• publicly display, or make the Licensed Content available for others to access or use,
• copy, print, install, sell, publish, transmit, lend, adapt, reuse, link to or post, make available or
distribute the Licensed Content to any third party,
• work around any technical limitations in the Licensed Content, or
• reverse engineer, decompile, remove or otherwise thwart any protections or disassemble the
Licensed Content except and only to the extent that applicable law expressly permits, despite this
limitation.
5. RESERVATION OF RIGHTS AND OWNERSHIP. Microsoft reserves all rights not expressly granted to
you in this agreement. The Licensed Content is protected by copyright and other intellectual property laws
and treaties. Microsoft or its suppliers own the title, copyright, and other intellectual property rights in the
Licensed Content.
6. EXPORT RESTRICTIONS. The Licensed Content is subject to United States export laws and regulations.
You must comply with all domestic and international export laws and regulations that apply to the Licensed
Content. These laws include restrictions on destinations, end users and end use. For additional information,
see www.microsoft.com/exporting.
7. SUPPORT SERVICES. Because the Licensed Content is “as is”, we may not provide support services for it.
8. TERMINATION. Without prejudice to any other rights, Microsoft may terminate this agreement if you fail
to comply with the terms and conditions of this agreement. Upon termination of this agreement for any
reason, you will immediately stop all use of and delete and destroy all copies of the Licensed Content in
your possession or under your control.
9. LINKS TO THIRD PARTY SITES. You may link to third party sites through the use of the Licensed
Content. The third party sites are not under the control of Microsoft, and Microsoft is not responsible for
the contents of any third party sites, any links contained in third party sites, or any changes or updates to
third party sites. Microsoft is not responsible for webcasting or any other form of transmission received
from any third party sites. Microsoft is providing these links to third party sites to you only as a
convenience, and the inclusion of any link does not imply an endorsement by Microsoft of the third party
site.
10. ENTIRE AGREEMENT. This agreement, and any additional terms for the Trainer Content, updates and
supplements are the entire agreement for the Licensed Content, updates and supplements.
12. LEGAL EFFECT. This agreement describes certain legal rights. You may have other rights under the laws
of your country. You may also have rights with respect to the party from whom you acquired the Licensed
Content. This agreement does not change your rights under the laws of your country if the laws of your
country do not permit it to do so.
13. DISCLAIMER OF WARRANTY. THE LICENSED CONTENT IS LICENSED "AS-IS" AND "AS
AVAILABLE." YOU BEAR THE RISK OF USING IT. MICROSOFT AND ITS RESPECTIVE
AFFILIATES GIVES NO EXPRESS WARRANTIES, GUARANTEES, OR CONDITIONS. YOU MAY
HAVE ADDITIONAL CONSUMER RIGHTS UNDER YOUR LOCAL LAWS WHICH THIS AGREEMENT
CANNOT CHANGE. TO THE EXTENT PERMITTED UNDER YOUR LOCAL LAWS, MICROSOFT AND
ITS RESPECTIVE AFFILIATES EXCLUDES ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
14. LIMITATION ON AND EXCLUSION OF REMEDIES AND DAMAGES. YOU CAN RECOVER FROM
MICROSOFT, ITS RESPECTIVE AFFILIATES AND ITS SUPPLIERS ONLY DIRECT DAMAGES UP
TO US$5.00. YOU CANNOT RECOVER ANY OTHER DAMAGES, INCLUDING CONSEQUENTIAL,
LOST PROFITS, SPECIAL, INDIRECT OR INCIDENTAL DAMAGES.
It also applies even if Microsoft knew or should have known about the possibility of the damages. The
above limitation or exclusion may not apply to you because your country may not allow the exclusion or
limitation of incidental, consequential or other damages.
Please note: As this Licensed Content is distributed in Quebec, Canada, some of the clauses in this
agreement are provided below in French.
Remarque : Ce le contenu sous licence étant distribué au Québec, Canada, certaines des clauses
dans ce contrat sont fournies ci-dessous en français.
EXONÉRATION DE GARANTIE. Le contenu sous licence visé par une licence est offert « tel quel ». Toute
utilisation de ce contenu sous licence est à votre seule risque et péril. Microsoft n’accorde aucune autre garantie
expresse. Vous pouvez bénéficier de droits additionnels en vertu du droit local sur la protection dues
consommateurs, que ce contrat ne peut modifier. La ou elles sont permises par le droit locale, les garanties
implicites de qualité marchande, d’adéquation à un usage particulier et d’absence de contrefaçon sont exclues.
EFFET JURIDIQUE. Le présent contrat décrit certains droits juridiques. Vous pourriez avoir d’autres droits
prévus par les lois de votre pays. Le présent contrat ne modifie pas les droits que vous confèrent les lois de votre
pays si celles-ci ne le permettent pas.
Acknowledgements
Microsoft Learning would like to acknowledge and thank the following for their contribution towards
developing this title. Their effort at various stages in the development has ensured that you have a good
classroom experience.
Contents
Module 1: Introduction to Self-Service BI Solutions
Module Overview 1-1
Course Description
Note: This first release (‘A’) MOC version of course 20778A supersedes course 10988B. It has had a
third day added and supports exam 70-778.
This three-day instructor-led course provides students with the knowledge and skills analyze data with
Power BI.
Audience
The primary audience for this course is BI professionals who need to analyze data utilizing Power BI.
The secondary audiences for this course are technically proficient business users.
Student Prerequisites
In addition to their professional experience, students who attend this training should already have the
following technical knowledge:
Basic knowledge of the Microsoft Windows operating system and its core functionality.
Basic knowledge of data warehouse schema topology (including star and snowflake schemas).
An awareness of key business priorities such as revenue, profitability, and financial accounting is
desirable.
Course Objectives
After completing this course, students will be able to:
Course Outline
The course outline is as follows:
Module 1: ‘Power BI Desktop Transformations’ describes what Power BI is and discusses Power BI data
transformations.
Module 2: ‘Power BI Desktop Modelling’ describes how to optimize data models and introduces
calculations and hierarchies.
Module 3: ‘Power BI Desktop Visualizations’ describes how to visualize your data and how to work
with multiple visualizations.
Module 4: ‘Power BI Service’ introduces working with the Power BI Service, how to configure a Power
BI dashboard and how to view a Power BI dashboard once it is built.
Module 5: ‘Working with Excel’ describes how to import data from Excel and how to analyze data in
Excel.
Module 6: ‘Organization Content Packs, Security and Groups’ describes how to collaborate using
Power BI data.
Module 7: ‘Direct Connectivity’ describes how to connect directly to data stores, particularly cloud
data and Analysis Services.
Module 8: ‘Developer API’ describes the Power BI developer API and custom visuals.
Module 9: ‘Power BI Mobile App’ introduces the Power BI mobile App and how to use it.
Course Materials
The following materials are included with your kit:
Course Handbook: a succinct classroom learning guide that provides the critical technical
information in a crisp, tightly-focused format, which is essential for an effective in-class learning
experience.
o Lessons: guide you through the learning objectives and provide the key points that are critical to
the success of the in-class learning experience.
o Labs: provide a real-world, hands-on platform for you to apply the knowledge and skills learned
in the module.
o Module Reviews and Takeaways: provide on-the-job reference material to boost knowledge
and skills retention.
Modules: include companion content, such as questions and answers, detailed demo steps and
additional reading links, for each lesson. Additionally, they include Lab Review questions and answers
and Module Reviews and Takeaways sections, which contain the review questions and answers, best
practices, common issues and troubleshooting tips with answers, and real-world issues and scenarios
with answers.
MCT USE ONLY. STUDENT USE PROHIBITED
About This Course iii
Resources: include well-categorized additional resources that give you immediate access to the most
current premium content on TechNet, MSDN®, or Microsoft® Press®.
Course evaluation: at the end of the course, you will have the opportunity to complete an online
evaluation to provide feedback on the course, training facility, and instructor.
Note: At the end of each lab, you must revert the virtual machines to a snapshot. You can
find the instructions for this procedure at the end of each lab
The following table shows the role of each virtual machine that is used in this course:
Software Configuration
The following software is installed on the virtual machines:
SQL2016
Microsoft Office 2016
SharePoint 2013SP1
Course Files
The files associated with the labs in this course are located in the D:\Labfiles folder on the 20778A-MIA-BI
machine.
MCT USE ONLY. STUDENT USE PROHIBITED
iv About This Course
Classroom Setup
Each classroom computer will have the same virtual machine configured in the same way.
Dual 120-gigabyte (GB) hard disks 7200 RM Serial ATA (SATA) or better
DVD drive
Network adapter
Additionally, the instructor’s computer must be connected to a projection display device that supports
SVGA 1024×768 pixels, 16-bit colors.
MCT USE ONLY. STUDENT USE PROHIBITED
1-1
Module 1
Introduction to Self-Service BI Solutions
Contents:
Module Overview 1-1
Module Overview
Business intelligence (BI) is a term that has become increasingly common over recent years. Along with
big data, data mining, predictive analytics, data science, and data stewards, BI is now very much part of
business vocabulary. Much of the impetus behind this is the need for organizations to cope with ever-
increasing datasets. It is now normal to have databases that contain millions of rows, requiring gigabytes,
terabytes, or even petabytes, of storage space. Data is no longer confined to an on-premises server
room—it is hosted in the cloud, feeds are taken from third-party providers, public datasets are freely
available, and social media interactions generate ever-expanding datasets.
Reporting and analysis is certainly not a new concept to business, but the difference between how data
analysis is done today, compared with five or 10 years ago, is immense. Nowadays, organizations need BI
to see not only what was done in the past, but also more of what is to come. There is now an
overwhelming amount of data to gather and compose into reports. There is also an increasing need for
data to offer up-to-the-minute numbers, so business can react faster to changing trends in markets and
industries. Those businesses that can react fast and predict near-term trends to provide products and
services where there is consumer demand have the best chance of survival in our modern and highly
competitive world. With the rise of big data, there is an increasing need for data analysts who can take
this data, and find the critical points within a plethora of information.
Objectives
After completing this module, you will be able to:
Lesson 1
Introduction to Business Intelligence
This lesson introduces you to the concepts that comprise BI. You will explore scenarios for using BI and
how current trends affect the use of BI, project roles and data models.
Lesson Objectives
After completing this lesson, you will be able to:
Understand BI scenarios.
See how trends in data and reporting solutions have affected BI.
Reporting
Extracting data from your company’s database and presenting it in reports is certainly not a new
phenomenon. Most organizations, whatever their size, use some form of reporting, as a reflection of
performance within their sector. Until recently, most organizations were happy with end-of-month and
annual reports, as a backward reflection of their performance. Modern reporting still needs this, but it
should also look to the future to predict where and how to sell more, thereby increasing turnover and
reducing the bottom line.
Traditionally, reports have been compiled by department heads, and then given to directors to guide their
decision-making. Organizational data, or business intelligence, was the privilege of a few. For example,
reports show metrics—how much did we sell last month? How many new customers have we acquired
this year? How many mentions did our latest promotion receive on social media? A report can provide the
answers to questions that the organization needs to make decisions. Reports can be contained in
spreadsheets, or created using a visual tool, and distributed on a daily, weekly, or other regular schedule.
Reflecting on past performance is a worthwhile task, but modern reports must also predict the future.
MCT USE ONLY. STUDENT USE PROHIBITED
1-4 Introduction to Self-Service BI Solutions
Analysis
Analysis is the process of evaluating data to find insights. Data analysis should answer questions, and offer
guidance in decision-making. Data is extracted from source, and then cleaned, modeled, and transformed
until it can be presented appropriately in a report. The report can be a simple table in a spreadsheet, or a
visual and dynamic, colorful solution. How the data is presented affects the analysis and the conclusions
drawn. For example, you can present data in a column chart, but not notice patterns in that data until you
use a different type of chart—such as a map or scatter chart—and discover clusters of behavior as a result
of geographic location, or outliers that are skewing results.
With so much data to analyze, and constant changes in consumer and market trends, modern data has a
limited lifespan. Data quickly becomes outdated, so the process of analysis is ongoing. However, with
bigger data to analyze, more questions can be asked. With an increase in publicly available datasets,
including population changes, socioeconomic data, weather patterns, and climate change, you can
analyze corporate data against a backdrop of relevant statistics.
Collaboration
Data is generated and consumed ubiquitously—it is no longer retained and controlled by a handful of
decision makers in an organization. Instead, data is used at all levels, meaning colleagues can react to it,
and change the course of their work. Information is critical to companies of all sizes and across industries,
with information workers needing to collaborate and share data and results. Microsoft Excel® has long
been the dominant tool of the business user—spreadsheets are created, shared, published, altered,
emailed, printed, saved, and distributed without version control, or adherence to security policies. As
spreadsheets are shared and changed, and shared again, analysts work from different datasets, see
different results, and reach different conclusions. To collaborate and work cohesively, analysts must be
able to synchronize their teamwork.
Using a more sophisticated reporting solution generally requires a dedicated report developer, and a
lengthy process to submit a feature requirement to IT, and wait for the report to be developed and
published—only to find it does not deliver the correct data. And so begins another lengthy process of
submitting a change request, and waiting for the report developer to make the changes. Giving users
access to the data means they can see what is available for analysis, and lets them decide what is useful.
The delay in waiting for a report not only frustrates users and holds back their work, but also delays
decision-making and the ability for organizations to react to changing circumstances.
Program Manager
The program manager is responsible for the organizational BI strategy and delivery, often coordinating
multiple projects at any one time. The program manager is the overall leader of the BI department and,
while the role is nontechnical, it does require an understanding of the subject matter, the business
requirements, and a comprehension of technical terminology. The main role of a program manager
includes:
Creating budgets.
Measuring performance.
Data Architect
Like the program manager, the data architect is responsible for multiple projects, combining business and
technical knowledge to shape the BI solutions. The data must be architected and presented in a design
that the organization can understand. The main role of the data architect includes:
Implementing databases.
Technical Architect
The technical architect must communicate with the BI developers, and the operations team to ensure the
BI environment is configured correctly. This role is less hands-on than the BI developer, but requires deep
technological understanding. The main role of the technical architect includes:
Assessing the existing BI environment.
Deciding on appropriate development technologies, and justifying the decisions to the program
manager.
Designing the architecture of the extract, transform, and load (ETL) processes.
BI Developer
The BI developer role can comprise ETL, data warehouse (DW), and report development. Depending on
the size of the organization and the structure of the team, one developer might specialize in one aspect,
or may perform one or more roles, but there is likely to be an overlap between at least two. The main role
of a BI developer includes:
Building ETL packages that perform data transformations in the staging area.
Writing ETL packages to load the transformed data into the data warehouse.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 1-7
Building cubes.
Data Modeling
A data model is a visual representation of how the data will be structured in a database. If the database is
an OLTP database, then the data will be normalized to reduce repeating values, and ensure an entity only
has the attributes that belong to it. This leads to the best performance for random, small, and isolated
transactions. A data warehouse denormalizes the data, so the database performs optimally for reporting.
A data model comprises a logical design, and a physical design. There are two approaches to data
modeling: a top-down approach, or a bottom-up approach. In a top-down approach, the model is
created by gaining an understanding of the business requirements. The bottom-up approach creates a
model from existing databases. A model is only a representation of the database, so it will contain objects
such as tables, columns, and relationships that can be visualized. A database developer uses the model to
develop the physical database.
Semantic Models
A semantic model is a data model that includes information to give meaning to the data. The semantic
information should enable the model to describe itself. Semantic models help to create consistency. The
dataset of a semantic model uses inherent structures, whereas in a database, the context of data is defined
through its relationships with other data. Semantic data models give representation to real-world entities
such as a Customer, Store, or Employee. A relational model breaks entities into parts, whereas the
semantic model uses the entity to fully represent itself.
MCT USE ONLY. STUDENT USE PROHIBITED
1-8 Introduction to Self-Service BI Solutions
Question: How does your organization approach BI? Is this a major part of the corporate
strategy? What BI solutions does your organization use? Is Excel used as a self-service tool?
What do you think are the major issues with your organization’s approach to BI?
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 1-9
Lesson 2
Introduction to Data Analysis
This lesson breaks down the components of data analysis. It looks at using queries to extract data from a
variety of data sources, using transformations to make imported data easier to work with, and using
visualizations to present data.
Lesson Objectives
After completing this lesson, you will be able to:
Understand how to use queries for extracting data from data sources.
Explain why transformations are needed.
Data Sources
A data source is the location, or repository for the
data you import into your data warehouse or
reporting tools. In a traditional data warehousing
scenario, an ETL package extracts the changed data
from the operational database, and loads it into a
staging area, before applying transformations to
ready the data for loading into the data warehouse.
Online transactional processing (OLTP) databases
are designed for random access, and are extremely
fast for small transactions. They perform much less
well at aggregations, whereas a data warehouse is
designed to make this a faster process. Extracting
data from operational systems, remodeling, transforming, and applying aggregations in the data
warehouse is a lengthy process that requires considerable funding and resources in an organization of any
size. In-memory data and real-time operational analytics have the advantage that the data does not need
to be extracted to a secondary location, because in-memory processing is designed for optimal
performance and can better handle aggregations.
However, the data an organization wants to analyze is typically not confined to an on-premises database
server. The online world in which third-party services and publicly available datasets interact with business
operations is now very much part of the regular data landscape. The boundaries of data have expanded to
disparate locations in the cloud. Data sources you are likely to add to your reports, include:
On-Premises Databases
Despite the current trend of moving databases to the cloud, most organizations hold some data on-
premises. These may include your Microsoft SQL Servers, including SQL Server Analysis Services
(SSAS), Active Directory® (AD), Exchange, and Access® databases. Your organization might also use
other main industry databases including Teradata, Oracle, MySQL, Sybase, IBM DB2, SAP HANA, and
PostgreSQL.
MCT USE ONLY. STUDENT USE PROHIBITED
1-10 Introduction to Self-Service BI Solutions
Cloud Databases
Cloud is becoming an increasingly popular choice, with Microsoft offering a wide range of Azure
cloud services. These include Azure® SQL Database, Azure SQL Data Warehouse, Azure Marketplace,
Azure HDInsight®, Azure Blob Storage, Azure Table Storage, Azure DocumentDB, and Azure Data
Lake Store.
Organizations are increasingly turning to Software as a Service (SaaS) providers, as a more cost
effective option than the development of in-house solutions. Your organization might use third-party
solutions such as Facebook, Marketo, and MailChimp, alongside Bing®, Google Analytics, GitHub,
and Zendesk. Having the ability to use the data generated from these services is important for
gathering a complete picture of activity in your data.
Files
Most organizations hold data in spreadsheets, and are likely to have data stored in Excel, or CSV format.
JSON and XML are popular languages for exchanging data between systems, and should be supported by
your BI solution as a data source. In addition, business users might have data stored in text format, which
requires importing into the BI solution.
Queries
You use queries to extract data from your data
sources. If you have connected to a database,
queries specify the tables and columns that you
want to export into your BI solution. Your BI
solution might offer the choice of importing entire
tables, or writing a query to specify the columns
you want. If you are connecting to a database such
as SQL Server, then using stored procedures to
query the data is a preferable option. A stored
procedure is a query that is stored on the server.
Stored procedures are more efficient than specific,
one-off queries, because SQL Server creates an
execution plan, which it reuses each time the procedure is called. This plan works out the optimal way to
retrieve the data, resulting in the fastest possible return of results. They can also be used by other
colleagues; sharing code prevents duplication of effort.
Depending on your role within the organization, you might be dependent on a database developer to
write the queries or stored procedures for you and, for security reasons, you might not have access to all
objects in the database. It is important that you only return rows and columns from the database that you
intend to use in your reports. Not only does importing unnecessary data create additional network traffic,
it also makes larger datasets more cumbersome to work with. You might be able to perform some
transformations in your queries or stored procedures, but your BI solution might provide features to
shape, format, and transform the data. If you are importing data from flat files, you will not be able to
query the data to be selective about which columns to import.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 1-11
Using DAX
If you are an advanced Excel user familiar with Excel formulas, you will find Data Analysis Expressions
(DAX) to be very much the same. Whereas Excel formulas operate at a row level, DAX is used with
relational datasets. You might have already used DAX in Power Pivot, or SQL Server Analysis Services
tabular models—DAX is now available in Power BI Desktop. This powerful formula language has evolved
from the Multidimensional Expression (MDX) language used for querying cubes, and has been merged
with Excel functions. DAX offers a library of more than 200 functions, operators, and constraints that mean
you can perform sophisticated transformations on your datasets.
If you are using Power BI Desktop for your self-service BI solution, then you can use DAX to enhance the
data you import, without having to depend on developers to do this for you. If you are importing data
that cannot be altered until after it has been imported, DAX again comes in useful. Writing Transact-SQL
or MDX scripts can be complex and time-consuming, whereas DAX is straightforward to learn and apply
to your datasets. For example, you can use DAX to concatenate columns in your dataset:
The following code uses DAX to concatenate the FirstName and LastName fields to create a new column
called FullName:
DAX is useful for creating calculations. In the following example, DAX functions are used to multiply the
current sales by 1.05, to give an estimated five percent increase, and then the figure is formatted as
currency:
The following DAX formula multiplies the TotalSales figure by 1.05, to give a predicated target sales figure
of five percent higher than the current year’s sales. It also formats the result into the local currency.
Data Transformations
The transformations step of the ETL process is often
the most time consuming. The data that is extracted
from the source system must be transformed into
the correct format for loading into the destination
database. How much transformation is needed
depends on how different the source and
destinations are, and also if multiple source systems
are extracted into the staging area. In even the
most straightforward ETL processes, it is likely that
some transformations are required. Metadata must
exist before transformations can be applied. The
metadata determines what transformations need to
be applied to the source data held in the staging tables, so it can be loaded into the destination database.
To accurately report on the data, you must ensure values are consistent if you intend to use them for
filtering.
MCT USE ONLY. STUDENT USE PROHIBITED
1-12 Introduction to Self-Service BI Solutions
Cleaning
Before applying any transformations to your data, it is a good idea to clean, or cleanse, the data first. This
process corrects dirty data, or removes it to another area for investigation. You want the quality of your
data to be as high as possible. Typical cleansing operations might include:
Detecting dirty data as it is loaded into the staging area, and either applying a transformation to data
that can be cleaned, or filtering the dirty data into a separate table for further investigation into why
it is incorrect in the source system.
Removing duplicate rows.
Performing logic tests to check date fields, such as checking to see if a date is earlier or later than
should be possible. For example, if the Ship Date is before the Order Date, then this data is dirty.
Performing character pattern testing to ensure phone numbers and email addresses are in the correct
format.
Checking data matches the business rules. For example, only one Sales Person manages a single
customer.
Formatting
After the data is cleaned, you can apply formatting to ensure the source data is compatible with the
destination data. Depending on how raw the data in the source system is, this often influences how much
formatting needs to be done. Typical formatting operations include:
Concatenating columns. For example, combining First Name and Last Name into a Full Name
column, or concatenating Address1, Address2, City, Country, and Postal Code into a Full Address
column.
Replacing shorthand values with full words to enable better filtering. For example, you could change
M, F, and U values to Male, Female, and Unknown, or S, M, D, W, to Single, Married, Divorced,
and Widowed. True and False values are frequently stored as 1 and 0 values in the source database,
and should be converted.
Changing the casing on text values. You may want to ensure country or state codes are all uppercase,
and names and address all have title case, with the first letter of each word in uppercase, the rest in
lowercase.
Dates might need to be formatted to full date time values to enable filtering at a low level of
granularity. The format of dates generally varies quite widely across systems, with no consistency, so
you need to be aware of formats, and ensure datetime values are converted to the same format and
locale.
Currency and number fields should be formatted and handled carefully. Ensure decimal columns that
undergo any rounding up or down do not skew figures and produce unexpected results. If accuracy is
critical, then you must ensure that values are entered correctly into the destination database. If
decision makers are not concerned about precision, and are happy with an approximate figure in
aggregations, then you have more freedom to apply some formatting.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 1-13
Key Lookups
If you are extracting data from an OLTP system for loading into a data warehouse, you need to convert
the database design from a relational format into a star schema. A star schema comprises a fact table,
with keys that relate to lookup values in dimension tables. To load data into the fact table, you need to
look up values from the dimension tables and select the appropriate key. You also need to account for
NULL values.
Aggregations
With very large datasets, it is common for aggregations to be performed in the staging area, and loaded
into the data warehouse. Aggregations across millions of rows can take a considerable amount of time to
run—this might mean that there would be an unacceptable amount of time for a user to wait while the
numbers were aggregated for a report. However, this is based on the traditional data warehousing model.
Modern database features, such as in-memory data, and columnstore indexes, enable faster performance
alongside up-to-the minute results. In the traditional data warehouse model, the data is usually loaded
overnight so that, more often than not, reports are at least one working day behind the actual data.
Visualization
Evolution has given humans the ability to recognize
patterns—this means we can instantly read and deal
with dangerous situations, helping us to survive. We
can very quickly identify irregularities, which means
we can recognize when a situation is no longer
regular—something has changed, and could be life
threatening. Although we are no longer presented
with the same dangers that early mankind endured,
we have retained the ability to visually assess and
make judgements within incredibly small
timeframes. In our modern world of information,
this innate ability can be applied to different
scenarios, primarily including the reading of data.
The way in which data is presented affects how quickly and efficiently you can process and understand it.
If you are presented with a table of numbers in a spreadsheet, it is likely you would need to reorder the
data and take some time to work out the highest and lowest values; you might not notice clustering,
outliers, or other patterns within the data. If you present the data on a map, or in a column or scatter
chart, you might instantly see the high and low values, such as customers who spend most on products
within a particular category live by the coast—or that males over 45 are the most popular return
customers. The context within which you place the data affects its interpretation.
The power tools within Excel have no doubt increased its popularity as a data analysis tool. This is because
users can quickly take data that is in a table format and difficult to comprehend, and convert it into
colorful charts and maps, which become instantly readable to the human eye. Tables of data, even when
ordered so values run from high to low or vice versa, still require us to read the numbers, and compare
rows of values. For example, when we view a colored pie chart, we can instantly see how the values are
distributed by the size of the portions. Initially, we do not need to know the values behind the portions;
we can make an instant assessment, and then start drilling down to obtain further detail. Visualizations are
vital for helping us make fast decisions about business data. They effectively eliminate the need for the
human brain to process raw numbers, search for patterns, or dig for outliers by manipulating the data.
MCT USE ONLY. STUDENT USE PROHIBITED
1-14 Introduction to Self-Service BI Solutions
Remove columns.
Format a column.
Demonstration Steps
1. Ensure that the MSL-TMG1, 20778A-MIA-DC, and 20778A-MIA-SQL virtual machines are running,
and then log on to 20778A-MIA-SQL as ADVENTUREWORKS\Student with the password
Pa$$w0rd.
3. In the User Account Control dialog box, click Yes. When prompted that do you want to continue
this operation, type Y and then wait for the script to finish.
6. On the Choose the download you want page, select the PBIDesktop_x64.msi check box, and then
click Next.
8. In the Microsoft Power BI Desktop (x64) Setup dialog box, on the Welcome to the Microsoft
Power BI Desktop (x64) Setup Wizard page, click Next.
9. On the Microsoft Software License Terms page, select the I accept the terms in the License
Agreement check box, and then click Next.
10. On the Destination Folder page, click Next.
11. On the Ready to install Microsoft Power BI Desktop (x64) page, click Install.
16. When the Get Data screen shows, click Get Data.
17. In the Get Data dialog box, click SQL Server database, and then click Connect.
18. In the SQL Server database dialog box, in the Server box, type MIA-SQL. In the Database
(optional) box, type AdventureWorksDW, and then click OK.
19. In the Access a SQL Server Database dialog box, leave the default settings unchanged, and click
Connect.
21. In the Navigator dialog box, select the FactInternetSales check box.
23. If the Connection Settings dialog box appears, leave Import checked and click OK.
24. In the Untitled - Query Editor window, in the Queries pane, click FactInternetSales.
33. In the Replace With box, type Married, and then click OK.
36. In the Replace With box, type Single, and then click OK.
39. In the Replace With box, type Female, and then click OK.
42. In the Replace With box, type Male, and then click OK.
46. On the Modeling tab, in the Formatting group, click Format: Currency General, point to Currency,
and then click $ English (United States).
47. In the Fields pane, right-click DimCustomer, and then click New column.
50. Click Save. Name the file Adventure Works Sales, and save the file to D:\Demofiles\Mod01.
Lesson 3
Introduction to Data Visualization
Data visualizations bring data to life, using colors and shapes to present data that would otherwise remain
as text and numbers. This lesson explores how visualizations help you discover insights into your data that
you would not otherwise find. The chart types in this lesson focus on the charts available in Power BI
Desktop; however, the principles of charting components are generally standard across BI solutions and
vendors.
Lesson Objectives
After completing this lesson, you will be able to:
Charts
Using the chart visuals in Power BI Desktop, you can
quickly create visually stunning and interactive
reports and dashboards. You can select a chart from
the Visualizations pane to add to the report
canvas, or you can drag a data field onto the report
to create automatically a table visual—which can
then be converted to another chart type. For
example, you could drag the Categories field onto
the report, which automatically creates a table. You
could then drag Total Sales onto the table, to add
another column. Then you could click one of the
chart icons in the Visualizations pane, and quickly
switch between a bar or pie chart.
Again, 100 percent stacked bar and column charts are similar to stacked and clustered charts, except the
bars and columns stretch the width or length of the chart area, and display the progress of each axis
against a value. You add two data fields to the Value, such as Sales YTD and Sales Quota. If you need to
display progress in attempting to meet a target figure, 100 percent stacked charts are useful.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 1-17
Note: If your data creates a large number of data points—for example, hundreds of bars on
a bar chart—the scrollbar will adjust so that it does not become too small. Instead, as you scroll
to the end, more data is loaded, but the scrollbar remains a viewable size.
Slicer
A slicer enables you to filter an entire report, applying the data selection to all visuals. You would add a
slicer to filter on fields such as Territory, Region, Sales Person, Color, or Category. By default, visuals show
values that include all data. Select a value in the slicer to filter all the visuals to show the data for the one
selected value.
Note: The Power BI slicer includes the ability to search through the filter list, which is useful
if the list is particularly long. On the slicer visual, click the ellipsis, then click Search, and start
typing your search string. The list will filter the results as you type. Click to select the value to
filter on.
Waterfall Chart
The waterfall chart enables you to show changes in a value over time, such as annual revenue. Using a
waterfall chart, you can see how changes affect a value, and color-coded columns quickly highlight any
increase or decrease in value. The chart includes two options: Category and Y Axis. For example, because
waterfall charts are typically used to show changes in a value over time, you could add Year to the
Category field, and Sales Variance to the Y Axis. This would display the data with the variance for each
MCT USE ONLY. STUDENT USE PROHIBITED
1-18 Introduction to Self-Service BI Solutions
year, flowing left to right from the earliest to the latest year. By default, increases would show as green
and decreases as red, though these are fully customizable. The chart also includes a total column on the
far right.
Cards
When presenting your data in a report or
dashboard, you should take care to ensure the most
important information is easy to find. If your
audience normally reads from left to right, top to
bottom, then displaying the most critical data in the
top left, flowing through to less important content
at the bottom right, is helpful. If you have
important figures that need to be presented clearly,
so that they can be easily read, then the Card and
Multirow card charts suit this purpose.
Card Chart
The card chart displays a single value and a
description. The numeric column values are aggregated to show the total value, such as Total Sales; the
data label is the name of the field. Before using the card chart, ensure that the field to be aggregated is
formatted correctly, especially if this represents financial data. If the Value column is not specified as a
currency data type, then it shows only a number without the currency symbol. This should be included to
make clear that it is a monetary figure. The data label can be turned off, but unless it is entirely clear what
the figure refers to, this is best included. You can rename the field by right-clicking on it in the Fields
pane, and selecting Rename. Again, be as clear as possible as to what this refers to. If you cannot change
the name of the field, you can hide the data label, and add a title instead. You can format the card to
change the background color and transparency, format the card border, and change the font properties
of both the data value, and the label and title.
KPIs
Key Performance Indicators enable companies to measure their progress towards a business objective, or
goal. KPIs can be created at a high level to measure the overall performance of the company, in addition
to being set at lower levels, such as by departments—for example, sales, call center, or warehouse. You
can add a KPI visual to your report in Power BI to track progress towards a target. Similar to the card
visual, the KPI displays a single value such as TotalSales for the current year—this is the Indicator. The
Target value is the goal, such as TargetSales. Add a data value such as Year to the Trend axis to display
how well the target is being met. This is represented as a filled line chart, and Power BI automatically
colors the filled area using green, yellow, or red to show if progress is good, neutral, or bad. These colors
can be changed using the Format options.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 1-19
Maps
Power BI Desktop includes a map chart, and a filled
map chart. These charts enable you to visually map
your data, both regionally and globally. Power BI
integrates with Bing maps to find default
coordinates for locations, based on a string value, in
a process known as geo-coding. This integration
means you do not need to provide longitude and
latitude coordinates in your data—this is optional,
because Bing makes a best guess at the location.
Map Chart
The map chart accepts data for the Legend,
Longitude, Latitude, Values, and Color saturation.
The Legend property accepts fields such as City, County, and Province, and the Values property accepts
numeric values such as Total Sales, or Number of Customers. The numeric values are presented as colored
bubbles on the applicable location specified in the Legend property. The bubbles are sized proportionally
to the data they represent within the field in the dataset; that is, the bigger the value, the bigger the
bubble. The map chart is useful for presenting data based on cities, rather than wide areas.
Shape Map
Shape Maps are similar to filled maps, in that they use color and saturation of color to represent the
underlying data, and do not display numeric data values on the map itself. The shape map is ideal for
comparing values across regions, such as demographic data. The visual includes predefined maps that you
can use to map your data. These include French regions, Canadian provinces, Mexican states, and UK
countries. Each region can be colored using the Data colors setting. Furthermore, you can use a custom
map using your own data, providing this is in the TopoJson format. To convert shapefiles or GeoJSON
maps into the correct format, you can use an online tool such as MapShaper.
Map Shaper
http://www.mapshaper.org
After creating the TopoJson file, add a Shape map visual to your Power BI report, and select Format.
Expand Shape, and click Add Map to import the data.
MCT USE ONLY. STUDENT USE PROHIBITED
1-20 Introduction to Self-Service BI Solutions
Tables
You can use table and matrix charts to add data
fields to create columns and build up a table. Each
numeric column is automatically aggregated, with a
total at the bottom of the column. Visually, the
table and matrix charts look quite similar. Using a
table or matrix is useful when you want to display
the actual numbers, such as for financial data, and is
best used for smaller sets of data. The table chart
includes the option to apply predefined styles,
which makes the data easier to read. You can set
styling such as alternate row highlighting and use
the predefined styles, or select custom colors for
the alternate rows to format the table to your exact requirements.
Consider the following table, which would appear much the same in a Power BI Desktop report. The chart
displays the total sales by category and country. It is consuming a lot of space, and requires you to read
through each of the values in the Sales Territory Country column, and then the figures in the Total
Sales column. Furthermore, the values in the Sales Territory Country column are ordered alphabetically,
which determines the order of the Total Sales column, making it difficult to compare the sales figures.
You might be able to order by each column, but not by Total Sales within the Accessories category only.
There is little difference in displaying data in a table in Power BI Desktop compared to Excel, or even a
SQL Server Reporting Services report. From the above table, you can see that it consumes space and takes
time to read. It is not interactive and does not offer any drill-through capability.
Conditional Formatting
You can customize the background color of a cell depending on its value, including the ability to use
gradient colors. After creating a table in Power BI, right-click the field in the Fields bucket of the
Visualizations pane that you want to colorize. From the menu, select Conditional Formatting. You can
then select the minimum and maximum colors, and set the values to be that of the lowest and highest
values in the data, or manually set the values. You can optionally add a center, or middle, value and color,
by clicking the Diverging box.
Tree Maps
The tree map might not physically represent a tree;
however, the principle behind its function is
representative of a tree with larger data scaling
through to smaller data, as if the data were
branches scaling down to twigs. The largest data
value, represented as a rectangle, is located in the
bottom left-hand corner, with the smallest in the
upper right-hand corner. For example, in Power BI
Desktop, add the City data field to Group, and
Total Sales to Values. Each city is represented by a
rectangle that is proportionate to the number of
sales, so the cities with the most sales have the
largest rectangles. This style of representing data is classed as hierarchical.
You can also have a second value within each of the main rectangles in a tree map. Using the above
example of Total Sales for each City, you could further break this down to include Category. Each
Category would be represented by a nested rectangle within the parent City rectangle. This presents the
data in a visual hierarchy that makes it quick to understand how the sales are spread across categories
within each city.
Note: The tree map chart visualization has been added to SQL Server 2016 Reporting
Services and is available for use in charts in much the same way as you would use it in Power BI
Desktop.
Unlike a table or matrix chart, the tree map is more efficient in how it uses the space it consumes in a
report. By showing both City and Category in the tree map, it has effectively flattened the data, and
prevents the need for drilling down to see categories for each city.
MCT USE ONLY. STUDENT USE PROHIBITED
1-22 Introduction to Self-Service BI Solutions
Formatting Charts
The visuals in Power BI include extensive options for
customizing how your data is displayed. Some of
the options available will depend on the type of
chart.
Settings
Each visual can be customized with colors and other
settings using Format, so you can easily use
corporate colors to ensure your Power BI reports
match the look and feel of business-specific colors.
This is particularly useful if you use the embedding
tools to include visuals within your own custom
applications or websites.
The title of each visual can be customized. Included by default, you can turn off the title to hide it
completely, or change the text, font color, text size, and background color, and set the alignment of the
text to left, right, or center. You can also choose to lock the aspect of the visual. Furthermore, under the
General settings, you can configure the X Position and Y Position of each visual, and specify Width and
Height, ensuring your visuals are of a consistent size in your reports. All visuals enable you to add a
border, which is not included by default, and you can change the color of the border to suit your design
requirements. Each group of settings includes a Revert to default button to reset the visual and remove
any formatting you have applied.
Other settings include the ability to show or hide axis, data labels, or legends, and set the colors of data
points. With a column chart, you can change the color of all columns, or set them individually based on
each data value. This is helpful if your report shows consistent data, such as sales by department or
category, whereby the department or category can be represented by color. For a supermarket, fresh fruit
and veg could be represented with green, frozen food with blue, pet food with brown, and so on. For
each visual, click Format to see the available options.
Shapes can be used to highlight or group items in a report. From the Insert group on the Home tab, click
Shapes, and choose from Rectangle, Oval, Line, Triangle, or Arrow. For example, you could use the
rectangle shape to group one set of visuals that contain data pertaining to sales, and another to group
visuals referring to product returns. You could also use the line shape to divide the report into sections
using horizontal and vertical lines. The arrow shape can be used to point to a spot on the report to which
you want to draw your colleague’s attention. Each shape can be customized, and you can change the
border and background colors, and add a title.
Adding a text box to your report is a useful feature for adding titles or extra heading to visuals. For
example, you could add a main heading to the report, and then a subheader to a group of visuals. To add
a text box, from the Insert group on the Home tab, click Text Box. Type the text into the main box, and
then you can format the face and size of the font, set bold, underline, italic formatting, and alignment—
and add a background color. Furthermore, you can create a hyperlink using a text box, using one or more
words in the text box.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 1-23
Images can be added from the Insert group on the Home tab, by selecting Image. Browse to the image
you want to add, and click Open. The image then appears on the report canvas, and you can add a title,
turn on the background color and set the transparency, and add a border. This is useful for adding logos
to your reports so they adhere to corporate design. You can also add a photo to a report.
Drill Through
Power BI visuals automatically include the ability to click on a data point such as a bar, line, or portion of a
donut chart, and it will display the underlying records. For example, right-click a bar in a bar chart and
click See Records to show a list of the underlying data, or click See Data to display both the visual and
the aggregations for each bar. This is available in both Power BI Desktop and the Power BI service.
Customizable Tooltips
By default, visuals will display a tooltip including the data point’s value and category. You can add other
fields to the tooltip by dragging a field from the Fields pane, to the Tooltip bucket on the Visualizations
pane. Right-click the field in the bucket list to choose from additional aggregations that can be applied to
the field.
Quick Calcs
Use the Quick Calcs feature to quickly change the aggregation that is applied to the data in a visual. The
default aggregation function is Sum, but you can change this by right-clicking on the Value field in the
Visualizations pane, and choosing a different function, such as Average, Minimum, Maximum, or Count.
Reference Lines
Use the Analytics pane to create trend, constant, and dynamic reference lines on selected visuals. A
constant reference line will be located at the value you specify—for example, 10 million on a sales bar
chart—regardless of the underlying data. Dynamic reference lines enable you to add lines based on
minimum, maximum, or average, which change dynamically depending on the underlying data.
Furthermore, you can have multiple lines on one chart, including more than one constant line. Each line
can be customized by changing the color, transparency, dash type, and whether the line sits in front or
behind the data points. The lines that you can add, depend upon the visual.
Area chart
Line chart
Scatter chart
Stacked Area
Stacked Bar
Stacked Column
Nonstacked Line
Demonstration Steps
1. In Power BI Desktop, in the Fields pane, under DimCustomer, select Gender, and MaritalStatus.
7. In the Fields pane, expand DimProduct, and drag the Color field onto the report canvas to create a
new table.
8. Under FactInternetSales, drag the OrderQuantity field onto the new table.
13. In the Fields pane, under FactInternetSales, drag the SalesAmount field onto the report canvas to
create a new column chart.
15. In the Fields pane, expand DimDate, and drag the EnglishMonthName to the Axis property.
16. Grab the resizer on the column chart to widen the chart so that the month names display clearly.
17. In the Visualizations pane, click Format, and then expand Title.
Donut Chart
Lesson 4
Overview of Self-Service BI
This lesson describes how the recent growth in data has driven the need for self-service BI solutions, and
compares managed enterprise BI to self-service BI solutions.
Lesson Objectives
After completing this lesson, you will be able to:
Understand how prolific data growth has affected and driven the BI market.
Data Explosion
The term “big data” was recently plunged into the
limelight to describe the vast quantities of
unstructured data being generated in our
technology-driven world. It is now a common term,
used not only by the CTOs and CIOs in the
boardrooms of major global organizations such as
Microsoft, Amazon, and Facebook, but also by
organizations in all sectors and of all sizes. It seems
that, these days, big data is unavoidable. Big data is
too large for traditional software programs to
capture, store, and manage, and presents a
challenge to businesses wanting to analyze this
data.
Big data is described using the following characteristics:
Volume: this is the quantity of data generated and stored. The data must be large enough to be
considered big data, and the size is also a determining factor of the value, and whether insights can
be gained from it.
Variety: this refers to the type of data. For example, data gathered from a Facebook feed would
gather text, photos and images, and video.
Velocity: this is the speed at which the data is generated and processed. Big data can be available in
real time, using in-stream technology to view it as it is in motion.
Variability: this refers to the consistency of the data; that is, how much does it vary? Inconsistency
causes issues with data processing and management.
Veracity: this is the quality of the captured data. The higher the quality, the better the results.
Organizations already have a lot of data, and the volume is constantly growing, with big data expanding
from terabytes to petabytes. It is not easy for business to cope, especially if an organization considers all
data to be valuable, and does not know how to separate any data that is not useful. However, big data
does have a shelf life, and before too long, becomes worthless. Also, there is a cost associated with storing
and managing the data.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 1-27
Budget: the budget is linked to the time it takes to build the BI infrastructure, and associated code
base. The amount of work required up front before anything tangible can be delivered is often a
concern for stakeholders. Developers might be working hard creating the ETL and data warehouse,
but until reports are delivered, stakeholders and users do not see that anything is actually being done.
This can be difficult for nontechnical users to understand—why must they wait so long for what they
MCT USE ONLY. STUDENT USE PROHIBITED
1-28 Introduction to Self-Service BI Solutions
consider to be a straightforward report? The cost of hiring BI developers is also expensive, especially if
contract staff are required solely for the length of time it takes to deliver the project.
Developer cost versus business user cost: in many instances, the cost of employing a report
developer is costlier than that of business users. It makes financial sense, therefore, to empower the
business user to create their own reports.
Lack of developer knowledge: while a report developer might be highly technically skilled, they do
not necessarily possess an understanding of the business, or the data. If this is the case, the developer
is unlikely to produce a report that details exactly what the user needs. This can be frustrating when a
user has been waiting for a developer to be available to create the report, only to find it is not what
they need. A request for change must then be submitted, and the user must wait for this work to be
done. However, a further request does not guarantee that the developer will produce what they need.
Changing requirements: in addition to user requests to change reports that do not actually give the
user the data they need, developers must cope with new requirements, and increasing volumes of
data. For example, with sales, marketing, finance, and support departments all using SaaS data
sources—requiring publicly available datasets to be included in their analysis, and statistics from
customer data and internet usage—the developer must continuously integrate new data.
However, even if an organization handed over all report development to the business users, there would
still be a requirement to build the ETL and data warehouse, provide access to the databases, ensure
security is properly implemented, and assist users with complex queries.
Self-Service BI Trend
Nowadays, big data is less about it being big, and
more about an organization’s ability to extract
useful insights from it, to improve company
performance. Many SaaS provides, such as
MailChimp and Google Analytics, already offer
some level of data analysis to their customers.
However, this usually involves the customer logging
into the SaaS portal to view the data. Having the
ability to download data from MailChimp, Twitter,
and Facebook, and combine this with a marketing
campaign created in Marketo, offers more cohesive
insights. Being able to analyze data and react to it
quickly, requires a quick turnaround time for processing data. Dependency on an IT department delays
this considerably, so business analysts utilizing a self-service BI approach have greater gains from their
data.
Furthermore, a wide range of tools are on offer in the self-service BI solutions marketplace, ranging from
Microsoft’s Power BI suite of tools—which is available on a free license—to solutions from popular
vendors such as Tableau, and Qlik, that are priced considerably higher. Yet, while the license fees may
initially appear steep, return on investment (ROI) of this initial financial cost is recouped when compared
to the time cost of employing a report developer to manually create equivalent reports, and manage
them. These tools can also deal with unstructured data better than spreadsheets, which need data in
tabular format before any visualizations can be applied. With the ubiquity of big data in business, it is fast
becoming a requirement that a BI tool can cope with the challenge.
Question: Given what you have learned so far in this module, regarding the limitations of
managed BI and the uptake of self-service BI with all its advantages, do you think there is a
future for managed BI?
MCT USE ONLY. STUDENT USE PROHIBITED
1-30 Introduction to Self-Service BI Solutions
Lesson 5
Considerations for Self-Service BI
This lesson looks at some of the important aspects to consider when planning a self-service BI solution.
This includes issues users might have when accessing data, the importance of data source reliability, how
users require analysis skills, and how a data steward can help.
Lesson Objectives
After completing this lesson, you will be able to:
Explain issues that arise when accessing data in a managed, and a self-service BI solution.
Data Access
By using self-service BI, users can connect to a wide
variety of data sources, including on-premises
databases and data warehouses, local files, cloud
services, SaaS hosted solutions, and public datasets.
While managed BI solutions tend to be more highly
controlled by policies maintained by IT, self-service
opens up the possibilities for importing data from
anywhere, outside the control of IT.
On-Premises Data
Self-service access to on-premises data can
generally be controlled by IT. Data can be
controlled in how it is shared with users, through
database security rules to restrict access to sensitive data. For example, users of SQL Server databases can
be given access to data views, which provide selective fields, without giving full access to other sensitive
data. It is imperative that data is protected and controlled, and also that business users have access to the
data they need to do their job.
Data from files such as Excel, CSV, text, and XML, can be emailed, shared, and imported into a self-service
BI solution. It is harder for IT to control and secure access to this data, because it is easily transferable,
both within the organization and externally.
Databases stored in the cloud, including Microsoft Azure SQL Database and Microsoft Azure SQL Data
Warehouse solutions, can be managed by IT and the same security principles can be applied. Users
connecting to cloud-based data stored by SaaS providers require a username and password.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 1-31
Data Traffic
Enabling users to access large datasets and transfer data by sharing reports can cause issues with the
volume of data moving around the network. With many users accessing data in a specific, one-off fashion,
the load on the network increases. IT needs to monitor the performance of servers and networks to
prevent bottlenecks. For managed BI solutions, this is less of an issue because precompiled queries
executed against the database provide better performance, and data is also cached.
Data Reliability
Data reliability refers to the condition of data, and
whether it is complete, and sufficiently free of
errors, so that the data is fit for purpose. This is
particularly relevant to data imported from public
sources. To be complete, the data fields must be
sufficiently populated. A dataset with a sparse
population of data across many fields and rows
cannot provide suitable results. The data need not
be entirely free of errors, but the errors that do exist
must not be severe enough to make the user
doubtful of the results and question their validity.
The data within each field should accurately
represent the field, be correct, and be of the correct data type. This ensures that the data can be analyzed
with confidence.
Risk Analysis
Risk analysis is a useful and often essential exercise to perform on data that is imported from sources
external to the organization. If you need to make serious decisions as a result of analyzing the data, then
consideration must be given to the reliability of the data. In such circumstances, the following questions
should be considered:
When performing risk analysis to determine the reliability of the data, the following questions should be
answered as part of the assessment:
Data Source: where has the data come from? Is the data provided by a reputable organization?
Data Refresh: how often is the data refreshed? Does the analysis that uses the data require it to be
kept up to date, for the reported results to be useful and accurate?
Data Owner: who owns the data? Does the organization require any permission to use the data? Is it
permissible to publish reports that include the data?
Connection: are there likely to be any issues connected with the data? What is the up time of servers
on which the data is stored? Will the data always be available, or is there a time limit on it?
Structure: will the structure of the data change, thereby requiring the dataset to be reimported?
MCT USE ONLY. STUDENT USE PROHIBITED
1-32 Introduction to Self-Service BI Solutions
Data from on-premises databases that store corporate information do not need to undergo such
extensive risk assessment. Data should already be qualified, especially if it is derived from a data
warehouse that has been designed and managed in-house.
User Expertise
Self-service BI solutions require less technical
knowledge than is needed to produce a managed
BI solution. The purpose is for users to create
reports as quickly as possible, with the least amount
of effort, so that time and energy can be spent on
analyzing the results of the reports. However,
having knowledge of the business, formatting data,
and understanding which visualizations best display
the data, are useful for making the most of the BI
solution.
Accessing Data
Users need to know where data is located, and how
to access it. Data stored in on-premises databases or data warehouses are supported by IT, so there is
likely to be scope for a developer to provide queries, or offer advice on exporting data. External guidance
might be required for accessing data held by third parties, including SaaS providers, and publicly available
datasets.
Formatting Data
Transforming and formatting data is an important step in the process of building reports. If the data is not
right, then the results will not be right. Users must understand the principles and structures of data that is
sourced from a relational database, a data warehouse, or an unstructured big data source, such as a social
media site. Skills are required to:
Perform data cleaning: remove duplicate rows, handle dirty data, and errors.
Format data types: ensure currency, number, and datetime columns have the correct data type.
Apply adequate filtering: ensure data can be filtered to the expected granularity. How do sales need
to be measured? Do “days” represent a fine enough granularity or does the report need to show
online sales by the hour?
Exclude redundant columns: columns and rows that are not needed in the dataset should be
removed, to make the dataset easier to manage and understand.
Displaying Data
Users should be familiar with all the major chart types and understand how to use them to display data
most effectively so that decisions can be made. For example, geographic data is best presented using a
map chart; a scatter chart should be used to show overlaps in data, clusters, and outliers. Financial data,
such as a share price, is best displayed using a line chart. There are plenty of free resources on the Internet
to show examples of all the chart types and how they can be used, which will help self-service BI users
quickly become familiar with chart types. Users should also understand how to create and use measures
and KPIs.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 1-33
Data Stewards
The data steward role is aligned more with the
business than with IT. A data steward ensures the
quality of the data in an organization is high and is
responsible for data governance. With the
proliferation of data in organizations, a data
steward is now considered less of a luxury, and
more of an essential role. A data steward has a
varied role in managing data, and is responsible for:
Removing duplicate data, particularly lookup data, or data that should be stored once.
Removing unused, out of date data; for example, a product category that is never used.
Documenting metadata.
The data steward should either possess skills in, or a thorough understanding of, the following areas:
Business expertise: the role of the data steward sits more with the business side than IT. It is crucial
that a data steward understands how the business functions and has departmental knowledge of all
business areas, such as finance, marketing, sales, enterprise resource planning (ERP), manufacturing,
retail, and supply chain.
Technical writing: the data steward is responsible for documenting the metadata and should be able
to write clearly, and with accuracy. The documentation spans multiple departments within the
organization and must be clear to all who read it.
Data modeling: although data modeling experience is not necessary, the data steward works closely
with the technical architect and, at the very least, needs an understanding of terminology.
Data warehousing: understanding data warehouse concepts, including ETL, is also essential for the
data steward to communicate effectively with BI developers.
Nonrelational database systems: the emergence and pervasiveness of big data requires an
understanding of unstructured, large volume datasets, the issues of managing them, and the
technology required to process them.
Programming skills: understanding programming and being able to directly manage data in the
database is a useful skill for the data steward.
Data that is managed by a data steward will be of a higher quality than data that is not. This quality will
be reflected in the data that is presented to customers, and data used in reporting and analysis. The
growth of data provides continuous challenges to the data steward—the rise of big data demands
another element of management that is less easy to apply, given the size and lack of structure.
Question: Discuss the role of the data steward. Does your organization have a data steward?
If not, do you think one is necessary? Discuss some of the issues your organization faces, that
your existing data steward manages, or that the addition of one could solve.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 1-35
Lesson 6
Microsoft Tools for Self-Service BI
This lesson reviews the different self-service BI solutions currently offered by Microsoft, and looks at the
benefits and restrictions of using each solution.
Lesson Objectives
After completing this lesson, you will be able to:
Explain how SharePoint® Server can be used for sharing and collaborating.
Developing Reports
Organizations using Reporting Services usually have a dedicated report developer to create and update
the organizational reports. The developer will have skills to query the relational database (OLTP) system,
and the data warehouse if one is used. Report Designer in Visual Studio® is the main development
environment for creating reports for SQL Server 2016 Reporting Services. Usually, the developer accepts
user requests to create a report based on a specification. Reports can span multiple pages, and SSRS
reports are particularly adept at managing data tables that expand to fit the size of the data, which may
be unknown at design time. Business users with more advanced skills can create their own reports using
Report Builder.
Deploying Reports
After developing a report, it is deployed to the Report Server. The dataset is deployed alongside the
report, and the data can be cached for faster report generation. This is useful when multiple users access
the report, but the data is not frequently updated, because it delivers a faster experience.
Report Subscriptions
By subscribing to scheduled reports, users can receive an email message with a report attached. With the
right permissions, users can generate reports using the Report Manager portal, and subscribe to report
subscriptions. Reports can be delivered as soon as data is updated, or can be emailed after the data
MCT USE ONLY. STUDENT USE PROHIBITED
1-36 Introduction to Self-Service BI Solutions
warehouse load has completed overnight, so that the report is available at the start of the business day.
Reports can be sent to users outside of the organizational domain.
More recently, with the launch of SQL Server 2016, SSRS has been upgraded to support HTML5 rendering,
and mobile reports. It also now includes a wider range of charts, including sunburst, and tree map charts,
which were introduced in SQL Server 2016 Reporting Services.
For more information on using Report Builder for SQL Server 2016, see:
Excel
Microsoft Excel has a loyal following of business
users, and its leadership in the spreadsheet software
market has long remained unchallenged. The
addition of the four power tools—Power Pivot,
Power Query, Power View, and Power Map—moved
Excel to new heights, bringing self-service BI to its
massive fan base. A key driver in the recent uptake
of self-service BI was the enabling of business users
to analyze and report on data without dependency
on a managed BI solution. These four power tools
have liberated business users, and reduced the
workload on IT to develop and manage a time-
consuming BI solution.
Power Pivot
Power Pivot was launched as an add-in to Excel in 2010, but since Office 2016, this is now included as part
of the standard installation. This feature enables advanced data modeling, and data analysis—much of
Power Pivot’s strength lies in its ability to handle large datasets that have been imported from different
data sources. You can use Power Pivot to convert raw data into useful, visual charts and maps, helping you
discover business insights, and trends. Using Power Pivot, you can:
Import millions of rows of data from different data sources, including external sources.
Create relationships between tables of data, including tables from different sources.
Integrate with the other power tools to create charts, pivot tables, maps, and interactive Power View
visualizations.
Note: To use Power Pivot in Office 2016, open Excel, and on the File menu, point to
Options, and then click Add-ins. In the Manage dialog box, click COM Add-ins, and then click
Go. Select Microsoft Power Pivot for Excel, and click OK.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 1-37
Power Query
Since Excel 2016, Power Query is known as Get & Transform, and the tools are located on the Data tab
in Excel. You can use Get & Transform to search for data sources, connect to the data source and import
the data, and then shape the data ready for visualizing. With Get & Transform, you can:
Connect: you can connect to local files including an Access database, CSV, or Excel file, data stored in
the cloud, and data located on the Internet, in addition to on-premises SQL Server, and SQL Server
Analysis Services databases, Oracle, and MySQL. You can also connect to SaaS providers such as
Facebook, and Salesforce, and big data sources including Hadoop.
Transform: you can transform data using the Query Editor. Transformations enable you to shape
your data so it is in the structure and format required to fulfil your reporting and analysis objectives.
You can create new columns, remove columns and rows, and split columns. Data types can be altered
to ensure number and currency values are aggregated and displayed correctly. Text data can be
cleaned and trimmed, and the case can be changed to upper, lower, or title. You can also write your
own transformations using the M Language.
Combine: you can combine rows from different tables to create a new table, and you can append
rows from one table to the end of the rows in another table.
Share: rather than saving your workbooks and distributing them to colleagues using email, you can
share the queries in your workbooks to the Power BI Data Catalog. You can also Merge and Append
queries.
Note: The data sources you can connect to depend on the license you have. Some sources
are only available to Professional, and Professional Plus license holders.
Each of the steps you perform as part of Get & Transform is recorded in the Query Editor, enabling you to
undo, redo, reorder, and even modify steps using the M Language.
Power View
Power View is an interactive visualization tool that you can use to quickly build a model, using the drag-
and-drop interface. You can use advanced pie charts, maps, and data hierarchies that enable drill-down
into your data. Also, you can create new relationships and add KPIs based on these new relationships.
Note: To use Power View in Office 2016, open Excel, and on the File menu, point to
Options, and then click Add-ins. In the Manage dialog box, click COM Add-ins, and then click
Go. Select Microsoft Power View for Excel, and click OK.
Power Map
With Power Map, you can plot and visualize your geographic data in three dimensions. The third
dimension offers greater insight into geographic and temporal data, that may not be discovered using a
two-dimensional map. Power map can take millions of rows from a table or data model, and plot these on
a map. You can also create custom regions to highlight localized data models.
Note: To use Power Map in Office 2016, open Excel, and on the File menu, point to
Options, and then Add-ins. In the Manage dialog box, click COM Add-ins, and then click Go.
Select Microsoft Power Map for Excel, and click OK.
MCT USE ONLY. STUDENT USE PROHIBITED
1-38 Introduction to Self-Service BI Solutions
SharePoint Server
Excel Services in SharePoint enable business users to
publish Excel workbooks for sharing with
colleagues. SharePoint combines with Office, Excel,
and SQL Server to create a self-service BI
environment. SharePoint 2013 features a Business
Intelligence Center site, so users can centrally store
and manage their data connections, reports,
dashboards, scorecards, apps, and web part pages.
Power Pivot for SharePoint extends the services offered by Excel Services in SharePoint, by delivering
server-side processing of Power Pivot workbooks. The Power Pivot document gallery enables users to
browse published Power Pivot workbooks, and configure when data is refreshed. Using the Power Pivot
Services, the embedded data model is deployed to an Analysis Services instance, where Excel Services can
query the model.
PerformancePoint services enables the creation and sharing of centrally managed dashboards. The reports
can be updated at any time, and can interact with KPIs and scorecards. A web part feature can filter the
data to deliver a specific report, or enable drill-down into the data. PerformancePoint includes a
Dashboard Designer that offers a friendly experience for creating and editing dashboards.
Sharing workbooks on a SharePoint Server removes the need for Excel files to be emailed and transferred
around the organization. Users can collaborate on the same projects, facilitating the sharing of ideas,
analysis, and data insights.
Power BI Desktop
Power BI Desktop shares many of the features
offered by the Excel power tools, so business users
will find transitioning between the two tools to be a
straightforward process. Power BI Desktop is a
stand-alone tool that enables you to import data,
model and apply transformations to your data, and
then create stunning, interactive reports. Reports
are uploaded to the Power BI service, where
colleagues can share reports, and create
dashboards. Power BI is available on a Free license,
or a Professional license that offers extra features,
and supports a higher volume of data for a small
monthly fee.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 1-39
Data Sources
From Power BI, you can connect to a wide range of data sources including:
Files: you can import from Excel, CSV, XML, Text, JSON, a folder, or a SharePoint folder.
Databases: all the main industry databases are supported—SQL Server, Access, SQL Server Analysis
Services, Oracle, IBM DB2, MySQL, PostgreSQL, Sybase, Teradata, and SAP HANA.
Azure: Microsoft Azure SQL Database, Microsoft Azure SQL Data Warehouse, Microsoft Azure
Marketplace, Microsoft Azure HDInsight, Microsoft Azure Blob Storage, Azure HDInsight Spark,
Microsoft Azure DocumentDB, Microsoft Azure Data Lake Store.
Online Services: the main SaaS providers are supported, including Dynamics CRM, Facebook, Google
Analytics, Salesforce, GitHub, MailChimp, Marketo, QuickBooks Online, Webtrends, and Zendesk.
Others: you can also import from a webpage, an OData feed, Hadoop, Active Directory, Microsoft
Exchange, ODBC, and R Script.
Power BI Desktop supports DirectQuery, which you can use to query the data source, rather than
importing the data. This is helpful when analyzing very large datasets.
Transformations
You can use Power BI Desktop to transform your data, and the Query Editor feature includes the same
functionality as Get & Transform in Excel. With DAX for Power BI, you can choose from more than 200
functions, constants, and operators, to help shape your data exactly how you need it. DAX for Power BI is
slightly different to Excel, as it works at the column, rather than the row level. You can also create
calculated columns, calculated tables, and measures, in addition to using the measures in your functions.
Reports
After importing, and transforming your data, you can drag visuals or fields onto the report designer, to
begin building reports. The visuals can be customized with colors, titles and text, and other settings
applicable to each type of chart. You can also create or download custom visuals for your reports.
Dashboards
One of the most powerful features of Power BI is the ability to quickly and easily share reports,
dashboards, and datasets. After publishing a report, you can use the report items, known as tiles, to create
a new dashboard, even combining charts, maps, and KPIs from different reports. With the Power BI
Service, Professional license holders can create content packs. A content pack is a bundle of reports,
dashboards, and datasets, that make it easy for colleagues to share their work. Users on a Free license can
download and view content packs. Reports can be published to the Power BI service, or Pyramid Analytics.
Power BI Mobile
Power BI offers a mobile app for iOS, Android, and Windows devices. Reports and dashboards
automatically adjust their size to fit the screen of the device, so you need not worry about creating mobile
versions of your work. The apps are free to download, and reports and dashboards are fully interactive.
Q&A
One very useful feature of Power BI is Q&A. This means you can ask questions of your data using the
Natural Query Language. You can type in a topic, such as Total sales last year in Canada. You can also
specify which chart visual the data should be presented in. When Power BI returns the result, you can pin
the visual to a new or existing dashboard.
MCT USE ONLY. STUDENT USE PROHIBITED
1-40 Introduction to Self-Service BI Solutions
Create a dashboard.
Demonstration Steps
1. In Power BI Desktop, on the Home tab, click Publish.
3. In the Power BI Desktop dialog box, enter the email address, and then click Sign in.
4. In the Sign in to your account dialog box, enter the password for your account, and then click Sign
in.
5. The report will then be published to the Power BI portal. When the window displays Success, click
Open 'Adventure Works Sales.pbix' in Power BI to view the report online.
6. When the browser opens, if you are prompted to Sign in, click Sign in and then enter your Power BI
credentials, enter your email address and password, and wait for the report to open.
7. On the Sales by Gender and Marital Status column chart, click Pin visual.
8. In the Pin to dashboard dialog box, click New dashboard, type Adventure Works Sales, and then
click Pin.
10. In the Pin to dashboard dialog box, click Existing dashboard, in the list click Adventure Works
Sales, and then click Pin.
12. In the Pin to dashboard dialog box, click Existing dashboard, in the list click Adventure Works
Sales, and then click Pin.
13. In the upper-left corner of the window, below the PowerBI icon, click Show the navigation pane.
14. Under Dashboards, point out the star icon to indicate a new dashboard, and click Adventure Works
Sales.
15. Drag the lower-right corner of the Sales by Month column chart, and expand it so it is as wide as the
two charts above it.
Power Map
Power Pack
Power Pivot
Power View
MCT USE ONLY. STUDENT USE PROHIBITED
1-42 Introduction to Self-Service BI Solutions
Objectives
After completing this lab, you will be able to:
Password: Pa$$w0rd
3. In the SalesPerson tab, click Summarize with PivotTable to create a new tab.
4. Add the FirstName to the Axis, and the SalesYTD to the Values.
9. Open the Adventure Works Sales workbook online, and then view the Sales Person Chart.
Results: At the end of this exercise, the Adventure Works Sales workbook will be published on SharePoint.
3. Name the file Adventure Works Sales, and save the file to the D:\Labfiles\Lab01\Starter\Project
folder.
3. Move the chart to the top left-hand corner of the report, and expand it to show all the days of the
week.
4. Change the title to Sales by Day of Week.
6. Drag the SalesAmount field from FactInternetSales onto the report, and add CalendarQuarter
from DimDate.
MCT USE ONLY. STUDENT USE PROHIBITED
1-44 Introduction to Self-Service BI Solutions
8. Rename the title of the chart Sales by Calendar Quarter, and center align the text.
9. Change the data colors so quarter 1 is red, quarter 2 is blue, and quarter 3 is yellow.
10. Move the chart to the right of the Sales by Day of Week chart, and make them the same size.
11. Drag SalesTerritoryCountry onto the report to create a map visual, and add SalesAmount from
FactInternetSales.
12. Rename the map title, Sales by Country, and center align the title.
14. Drag the CommuteDistance field from DimCustomer onto the report under the Sales by Calendar
Quarter chart. Add SalesAmount from FactInternetSales.
16. Rename the chart Sales by Commute Distance, and center align the text.
Results: At the end of this exercise, you will have a new Power BI Report.
2. Pin Sales by Day of Week to a new dashboard named Adventure Works Sales.
7. Ask Power BI which country has the most male customers, and pin the results to the Adventure
Works Sales dashboard.
8. Pin the visual to the Adventure Works Sales dashboard.
9. Under My Workspace, Dashboards, click Adventure Works Sales to refresh the dashboard.
Results: At the end of this exercise, you will have published a report to create a dashboard.
Question: Discuss using Power BI Desktop and Power BI Service, compared to using Excel
and Excel Services in SharePoint. Which do you think is the best, and why?
Question: Has your organization started using Power BI? If not, how easy do you think it will
be to implement, and convert existing business users from Excel, or other BI solutions? If you
have already started using it, how do users find the experience compared to the previous
solution?
MCT USE ONLY. STUDENT USE PROHIBITED
1-46 Introduction to Self-Service BI Solutions
Module 2
Introducing Power BI
Contents:
Module Overview 2-1
Module Overview
Self-Service Business Intelligence (BI) has rapidly grown in popularity because of its ability to empower
users to generate reports, process data, perform analysis, and more—all without having to depend on a
report developer. The Self-Service BI trend is driven by Microsoft's commitment to improving Excel® and
Power BI, both products having seen many enhancements over recent years. However, despite Microsoft
enabling deeper data analysis with the four power tools added to Excel—Power Pivot, Power View, Power
Query, and Power Map—they are not fully integrated into the Excel interface. Instead, they exist in
separate windows. Add to this the complexity of publishing to SharePoint® to share reports with
colleagues, and it all becomes a time-consuming effort.
Using Power BI eliminates complications and barriers with a simple integrated user interface, and has the
ability to publish rapidly to a cloud-based portal to share reports easily. This module introduces Power BI,
and explores the features that enable the rapid creation and publication of sophisticated data
visualizations.
Objectives
After completing this module, you will be able to:
Develop reports using the Power BI Desktop app, and use report items to create dashboards on the
Power BI portal.
Understand the components of the Power BI service, including licensing and tenant management.
MCT USE ONLY. STUDENT USE PROHIBITED
2-2 Introducing Power BI
Lesson 1
Power BI
In this lesson, you will learn about the main features of Power BI that will help you create and publish
reports to the Power BI portal, where you can create dashboards.
Lesson Objectives
After completing this lesson, you will be able to:
Furthermore, you can connect to Software as a Service (SaaS) providers, such as Facebook, Salesforce,
MailChimp, and Google Analytics. You can then publish your reports and datasets to the Power BI Service
portal to create and share dashboards with your colleagues. You do not have to use the desktop app to
create reports; you can also sign in to the portal, import data, and create reports online. The report items
can then be used in dashboards. You view and interact with reports and dashboards using the Power BI
Mobile app for iOS, Android, and Windows 10 mobile devices.
You can use the natural query language to ask questions from your data through Power BI Q&A. This
interactive service quickly finds the answers within your data.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 2-3
PowerBI.com
The PowerBI.com web portal, part of the Power BI
Service, is where you publish your reports, create
dashboards and content packs, and share data with
others in your organization. Microsoft is applying
weekly updates to the portal, continuously
enhancing the service. Furthermore, if you require
functionality that is not on the portal, you can use
the feedback facility to request a new feature and
send ideas, rate the service, and vote on which
features you think Microsoft should add next.
Dashboards. You create dashboards from your reports by pinning report items such as bar or pie
charts, to new or existing dashboards. Dashboards can be included in content packs and shared with
others in your organization. When you add a content pack created by someone else in your
organization, or from a service, any dashboards included in the content pack are included in the list.
Reports. All the reports you have published from Power BI Desktop are listed alphabetically in this
section. If you add content packs that include reports to your workspace, they are included here and
integrated into the list.
Datasets. When you add a dataset to a report and publish it, the datasets used in the report are
published to the portal, and listed alphabetically. You can use these datasets to create new reports
while signed in to the portal. When you add a content pack, it is very likely to include datasets. These
are shown here, with an icon indicating that they have been shared with you.
Get Data. You can import data into the portal from a variety of sources. You can create shared
content packs, or connect to content packs provided by SaaS companies. Data can be imported from
files, including reports and workbooks in Excel, CSV, and Power BI Desktop. You can connect to your
local file system, SharePoint team sites, OneDrive® Personal, and OneDrive Business.
Power BI Desktop
Power BI Desktop combines Microsoft's Power
Query engine, also known as M, with data modeling
and visualizations, to provide data analysts with a
flexible tool for quickly creating interactive reports.
3. Create reports that can be shared with, and enhanced by, others.
The Power BI Desktop features a workspace for creating reports. It comprises three key views in which you
work:
1. Report View. This is your main workspace for adding report items, such as bar charts, maps, and pie
charts, and displaying data using these report items.
2. Data View. You can use the data view to view imported datasets, in addition to shaping the data
using transformations and M expressions.
3. Relationship View. Power BI autodetects relationships from structured data sources, such as SQL
Server, or Microsoft Access®. Autodetection might not work for flat files, but after you have imported
data, you can create relationships, and set the cardinality and cross-filter properties of the
relationships.
Signing in to Power BI
When you first launch Power BI Desktop, the start screen gives you the option to sign in to your Power BI
account. If you choose not to sign in at this point, you can optionally sign in later using the Sign in link in
the top right-hand corner of the screen. You can also use this link to switch accounts when signed in. To
sign out, select File, Sign Out.
Reports
You can create multipage reports using Power BI
Desktop or the PowerBI.com portal, but the Power
BI Desktop app is likely to be your main tool for
designing reports. The first step in creating a report
is to connect to your data. Power BI Desktop
supports a wide range of database, file, and SaaS
connections and, along with the monthly software
updates, new compatible data sources are
continuously added. Data is imported into datasets,
which can be transformed before using in
visualizations.
without its limitations, so you should shape data before you create your dataset. Note that you can only
use tables from a single data source.
You can add pages to your report from the Insert ribbon menu, which gives you the option of New Page,
or Duplicate Page. Report pages can be added and deleted using the tab at the bottom of each page.
You can also right-click a tab to duplicate the report page. After you have added a dataset, the Measures
menu is activated, and enables you to create measures and add columns. The Publish button on the
Share menu prompts you to sign in to your Power BI account, so you can upload reports to the portal,
from where you can create dashboards.
You can also transform your data before you import it. Connect to your data source and, after you select
the data you want to import, choose Edit rather than Load. This opens the Query Editor window where
you can shape your data.
You can edit an existing template and resave the file as a .pbit template, or edit and save as a standard
.pbix report file. To create a template file, design the report you want to use as the basis for the template,
then choose File, Save As, and then select Save as type: Power BI Template File (*.pbit). Alternatively
click File, Export, then Power BI Template. You can open an existing template by clicking File, Import,
and then Power BI Template, or File, Open, and then navigate to the location of the template file,
selecting Power BI Template File (*.pbit) from the list.
MCT USE ONLY. STUDENT USE PROHIBITED
2-6 Introducing Power BI
Dashboards
After you have created the reports, you publish
them to the PowerBI.com portal so they can be
used to create dashboards. By sharing your reports
with colleagues, you enable them to create their
own dashboards and data insights. To publish a
report, open the report in Power BI, and click
Publish. You might be prompted to sign in to
Power BI. After your credentials are confirmed, the
report is published. If the report already exists on
the portal, you are prompted to confirm the
overwriting of any existing datasets that have
changed.
Creating Dashboards
A Power BI user can create personalized dashboards using the reports and data that are available.
Dashboards are an easy and effective method for combining data from disparate sources and reports. Any
chart or item (known as a visual) from one or more reports can be intermixed on a dashboard. With this
flexibility, users can build profiles of data and search for trends or answers to questions. Dashboards are
created by pinning visuals to a new or existing dashboard. These visuals are created as tiles on the
dashboard.
Dashboard Sharing
You can share, or unshare, a dashboard with other users in a group. After a colleague accepts an invitation
to share a dashboard, it appears in their My Workspace menu, along with the reports associated with the
dashboard. The dashboard is read-only for the recipient of the shared invitation. To share a dashboard
from Power BI, right-click the name of the dashboard in the My Workspace menu. Click Share to open
the Share dashboard window. You can then enter one or more email recipients, along with a message to
describe the dashboard.
Focus Mode
To view a tile in greater detail, use the focus mode feature. In the top right-hand corner of the tile you
want to view, click Focus mode. This expands the tile so it is the only tile in view. You can then begin
filtering and drilling through your data as appropriate. Click Exit focus mode to return to the dashboard.
This works equally within reports. Click Focus mode to expand the visual, and then click Back to Report
to return to the main report view. When used in your dashboards, this differs from the Full Screen Mode,
as the focus mode retains menus and controls to enable you to filter the data.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 2-7
The Fit to Screen button improves a dashboard that does not have enough tiles to fill the full screen, and
has excess background space. For example, if there are only a few small charts on a dashboard, the Fit to
Screen button zooms in to enlarge the items and fill as much empty space as possible—this makes the
charts easier to read and improves the presentation of the dashboard.
Favorite Dashboards
You can make a dashboard a favorite so you can access it from anywhere within the Power BI service. To
do this, select a dashboard from the navigation pane on the left-hand side. When the dashboard loads,
click Favorite. Click Favorites on the navigation pane to see all your favorite dashboards. To remove a
dashboard from your favorites, hover your mouse over the dashboard tile to bring up the icons, and click
Unfavorite. Alternatively, open the dashboard from the navigation menu to view it then click Unfavorite
from the top right-hand corner.
Featured Dashboard
A featured dashboard is like a favorite dashboard, but is given the status of being the first dashboard you
see when you log in. You can also view it immediately by clicking Featured Dashboard on the navigation
pane. To make a dashboard the featured dashboard, select it from the My Workspace pane to open the
dashboard. In the top right-hand corner of the screen, click the ellipsis, then select Set as Featured
dashboard. In the confirmation window, click Set as Featured dashboard. You can now view this from
the navigation pane. To change the featured dashboard, open the dashboard you want to use instead,
and follow the above steps, confirming the replacement. If you want to remove the featured dashboard
without replacing it, click the ellipsis next to Featured dashboard on the navigation pane, and select
Disable featured dashboard.
Customize Visuals
You can fully customize each visual, with colors, labels, borders, and titles. You change colors so they
match corporate colors or, when creating reports for departments, colors could be used to distinguish
departments—for example, blue for finance, yellow for sales, red for marketing. Labels and titles can
enhance the descriptive text given to a visual—you can also include a text box next to a visual to add a
lengthier description where appropriate. Visuals that are related, or work with a slicer, can be grouped
together using shapes. Rectangle and line shapes help to contextually group or partition visuals.
Positioning
Published reports might not be editable to the end user, so users cannot move the visuals around on the
canvas if they are placed inappropriately. When a user creates a dashboard, they can move pinned tiles
around on the canvas. When creating a report or dashboard, the most important information should be
presented first, in the top left-hand corner of the screen. This is particularly important when designing for
mobile devices; a user will not be able to move pinned items, so it is vital to have the most important
visual at the top—so it is visible first on a small mobile phone screen.
Audience
Think about the person who will consume your reports and dashboards. What metrics are important to
them? Are specific key performance indicators (KPIs) needed for them to measure the effectiveness of
their department, or their role? A salesperson might want to see how close they are to their sales target,
whereas the sales director will want to see how each salesperson is progressing.
You can also consider where the dashboard will be viewed. If it is to be displayed on a TV or large
monitor, then you can include more content than you would for displaying on a mobile phone.
Furthermore, displaying your dashboard in full screen mode removes menu bars and other distractions.
Story Telling
Reports and dashboards should not be cluttered, and show only relevant and related data. When creating
reports, use multiple pages to group related visuals by department or subject. Rename the tabs at the
bottom of the screen to help users quickly find data. Try to avoid having so many visuals on a report or
dashboard that make the user scroll across or down.
Look at both the fields and the data values you want to present in a chart. If the data includes
geographic fields, a map chart might be best. However, if values need to be displayed
proportionately, then perhaps a pie or tree map would be appropriate. Would a constant or reference
line add value to a chart? Try a few chart types if you are unsure, then you can see how the data is
presented and which works best.
Your charts should be consistent, both in terms of design and axes. Ensure scales on axes and the
order of dimensions are consistent, and be aware of how you use colors.
When displaying numbers, avoid using too many numerals, as this makes it difficult to read. Rather
than displaying a card with $145,000,000, present the data as $145m or $145 million, because this is
quicker and easier for the mind to interpret.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 2-9
Charts that present data over time should also be consistent, especially if you apply filtering. For
example, don’t have one chart that displays data for the last quarter next to a chart showing data for
April last year.
In addition to avoiding showing different time precision, apply the same principal to measures, and
avoid mixing measures of different scales. Showing one scale in millions and another in thousands
makes them difficult to compare.
How you sort your charts can make a difference to how well the data can be interpreted. If you want
the user’s attention to be drawn to the highest or lowest number, sort the chart by that measure.
Avoid using pie charts when you have many categories. When the number exceeds about seven or
eight categories, choose another visual such as a bar or column chart. If there are too many, this
makes it difficult to compare in a pie chart.
Demonstration Steps
Create a Report with Power BI Desktop
1. Ensure the MSL-TMG1, 20778A-MIA-DC and 20778A-MIA-SQL virtual machines are running, log on
to 20778A-MIA-SQL as ADVENTUREWORKS\Student with the password Pa$$w0rd.
4. Start SQL Server Management Studio and connect to the MIA-SQL database engine instance using
Windows authentication.
5. Open the Demo.ssmssln solution in the D:\Demofiles\Mod02\Demo folder.
9. In the Get Data dialog box, click Microsoft Azure SQL Database, and then click Connect.
10. In the SQL Server Database window, in the Server box, type the URL of the Azure server <Server
Name>.database.windows.net (where <Server Name> is the name of the server you created), and in
the Database box, type AdventureWorksLT.
12. In SQL Server Management Studio, copy the 1 - Power BI.sql query.
13. In the Power BI Desktop, paste the query into the SQL statement (optional, requires database)
box, and then click OK.
16. In the Password box, type Pa$$w0rd, and then click Connect.
18. If the Connection Settings window opens, leave Import selected, and click OK.
20. In the Fields pane, under Query1, select ProductName and TotalSales. The chart will auto populate.
Expand the chart control to horizontally show the full names of the products.
22. Expand Title, and change the Title Text value to Top 10 Selling Products.
26. On the File menu, click Save As. Name the report Adventure Works Sales, and save to the
D:\Demofiles\Mod02\Demo folder.
27. Leave Power BI Desktop and the report open for the next demonstration.
You can import data and create reports with the Power BI Desktop app.
You can create and share dashboards on the PowerBI.com online portal.
Data can be imported from an on-premises SQL Server or Azure SQL Database.
Lesson 2
The Power BI Service
In this lesson, you will learn about the licensing structure of Power BI, and explore the many options
available when creating datasets. You will also be introduced to content packs, learn how the natural
query language can answer questions about your data, and understand tenant management.
Lesson Objectives
At the end of this lesson, you will be able to:
Licensing
Power BI offers a straightforward licensing model,
with a choice of a free Power BI account, or a Power
BI Pro subscription account. A free account requires
a work or school email address, so personal
domains such as Gmail, Hotmail, or Yahoo, are not
permissible. Power BI Pro accounts can be
purchased individually, or for an organization using
the organization’s Office 365 Admin Portal. You do
not need to purchase an Office 365 subscription to
use a free Power BI account.
Store up to 1 GB of data.
Import data and reports from Microsoft Excel, CSV, and Power BI Desktop files.
Create and share reports and dashboards with other Power BI users.
View dashboards on a mobile device using any of the Power BI Mobile apps for iOS, Android, and
Windows.
Consume content packs from SaaS providers, including Bing, Salesforce, Zendesk, and MailChimp.
Use the Publish to web feature to share Power BI reports on public websites, including blogs.
MCT USE ONLY. STUDENT USE PROHIBITED
2-12 Introducing Power BI
A Power BI Pro subscription includes all of the above features, along with the following:
Store up to 10 GB data.
Consume up to 1 million rows of streaming data per hour in dashboards and reports.
Use the Power BI REST API to push live data into a Power BI dataset.
View live data by directly connecting to sources, rather than bringing the data into Power BI.
Organizations can have a mix of free and Power BI Pro accounts. However, to consume Power BI Pro
content, users must have a Power BI Pro license. For full service details and local pricing, please see:
Power BI Pricing
http://aka.ms/Qz9yz8
Tenant Management
Power BI uses a self-service sign-up model so that
users can create an account without dependency
upon either an Office 365 administrator, or an
Office 365 subscription. When an individual from an
organization signs up to Power BI, a tenant is
automatically created. A tenant is a domain within
your organization; for example, contoso.com. If
another user from the same organization signs up,
that user is added to the existing tenant. All users
within the same tenant become part of the same
network; this means they can share reports,
dashboards, and datasets. In this situation, the
agreement is between Microsoft and the user, so no organization intervention or responsibility is required.
Users can also reset their password directly from Microsoft, using an email verification process.
Administrator Sign-Up
Administrators can sign up to Power BI via the PowerBI.com website, or through the Purchase Services
section within the Office 365 Admin Portal. Administrators can then assign licenses to users within the
tenant. In addition, users can still sign up individually, and be automatically assigned an available Power BI
license. If the user does not already have an Office 365 account, an account is also created for them.
For more information on managing tenants, including the prevention of users joining a tenant, see:
For more information on the Power BI architecture and Power BI security, see:
Power BI Security
http://aka.ms/Bk38nc
Datasets
A dataset is created when you import data into
Power BI Desktop, or through the Power BI portal.
The dataset can be used across multiple reports;
you can shape and combine the data in your
datasets. In Power BI Desktop, you have a wider
choice of sources to import from, including
database, file, and SaaS connections, as described
here.
Database Connectors
Power BI supports the main industry database and
file connections for importing data from on-
premises sources. Recent additions include the R
Script connector for querying a local R installation, and the SQL Server Analysis Services (SSAS)
multidimensional model connector. Database connectors include:
1. SQL Server
3. R Script
4. Microsoft Access
5. Oracle
6. IBM DB2
7. MySQL
8. SAP HANA
9. PostgreSQL
10. Sybase
11. Teradata
MCT USE ONLY. STUDENT USE PROHIBITED
2-14 Introducing Power BI
File Connectors
You can import from a single file, or choose a folder to select multiple files to import. This is useful when
you have a folder location used to store files created on a schedule. File connectors include:
1. Microsoft Excel
2. CSV
3. XML
4. Text
1. Bing
2. Google Analytics
3. Intuit QuickBooks
4. MailChimp
5. Facebook
8. GitHub
Users can connect to SaaS applications and import the data to create reports and dashboards. Due to its
flexibility, Power BI can combine multiple sources of data from disparate SaaS vendors into one central
reporting space. For example, figures from Salesforce can be combined with a recent marketing campaign
that was delivered using MailChimp, alongside marketing data from Facebook.
You can quickly create a table by copying and pasting data directly from an Excel or text file. From the
Home ribbon, click Enter Data to open the Create Table window. Right-click and choose Paste to copy
data from another file. You can work with this table within your dataset, just as you would with data from
any other source.
You can perform some basic operations on your datasets in the Report View. In the Fields pane, you can
add or delete columns, rename the table and columns, refresh the data, and create a new measure.
However, most of the work you perform on your datasets will be in the Data View window, or the Query
Editor. The Query Editor offers more complex transformations than the Data View—such as column splits,
rounding, aggregations, statistical and scientific operations.
Refreshing Data
When you publish a report to the Power BI portal, the datasets are published too. You can use the Power
BI portal to refresh the data within your datasets. Click the ellipsis next to a dataset to open the dataset
menu. You can choose to Refresh Now, or Schedule Refresh. If you want to schedule a data refresh, you
should follow the instructions for downloading the Power BI Gateway.
You can also refresh your data in Power BI Desktop by clicking Refresh on the Home ribbon. When
viewing a dataset in the Query Editor window, you might see a message such as “This preview may be up
to 35 days old”. You can click the Refresh button to update the data, though the data might not have
been altered. This applies to each table within your dataset, so you have control over exactly which tables
to update.
Row-Level Security
Row-level security (RLS) enables you to restrict the
data a user can view, based on filters. These filters
work at the row level to control what data is
returned to the user, and can be managed using
roles. In addition to configuring RLS on your data
models in the Power BI Desktop, you can also
configure datasets using DirectQuery. In Power BI
Desktop, roles cannot be defined for SQL Server
Analysis Services live connections; this must be
done within the Analysis Services model. If you have
enabled the option Enable cross filtering in both
directions, this not only applies the cross filter, but
also the security in both directions.
To configure RLS, you start by defining roles and rules within Power BI Desktop, and then publish these to
the Power BI Service:
1. Import data into Power BI Desktop, or configure a DirectQuery connection.
2. From the Security group on the Modeling ribbon, select Manage Roles.
6. The filter will be a DAX rule that returns true or false; for example, [Region] = “South West”. In the
Table Filter DAX Expression box, type in the DAX expression, and then click the tick button to
validate the expression. You can also click the table name and choose Add filter. You can then insert
a column from the table into the DAX filter text box.
7. Repeat steps 5 and 6 to create further filters on other tables.
8. Click Save.
MCT USE ONLY. STUDENT USE PROHIBITED
2-16 Introducing Power BI
In Power BI Desktop, you cannot assign users to roles, because this is done in the Power BI service.
However, you can use the USERNAME() function alongside table relationships to dynamically restrict data
to the current user. After creating a role, you can then test it:
1. From the Security group on the Modeling ribbon, select View As Roles.
2. Select one or more roles, and click OK to apply the filtering. Additionally, select Other user, and type
in the name of another user for whom you want to test: for testing as it would appear in the Power BI
service, type the user principal name (UPN), such as [email protected].
3. You can use this in the Report or Data view to see the restricted results.
4. Click the Stop viewing button at the top of the view to remove the applied filters.
Limitations
There are limitations to using row-level security that you need to be aware of:
Roles and rules created in the Power BI service need to be recreated in Power BI Desktop.
RLS can only be defined on datasets created in Power BI Desktop. If you want to use RLS with datasets
created in Excel, you must first convert the Excel file to a Power BI (.pbix) file.
Only imported data and DirectQuery connections are supported. Live connections to SSAS are
handled in the on-premises data model.
Cortana and Q&A do not support RLS.
Content Packs
Content packs are packaged reports, dashboards
and datasets, which can be shared with other Power
BI users in your organization. When you connect to
a content pack on the PowerBI.com portal, the
report items are merged into your workspace lists.
Users with a free Power BI account can view content
packs, but they cannot create them. Content packs
can be created to customize reports or dashboards
for users in different departments within your
organization. For example, you could create a set of
reports with targeted visuals for finance, sales, and
manufacturing, because each department is likely
to want different data with which to measure performance.
When you publish a content pack, you choose who you want to give access to. You can choose specific
groups, such as Sales, or Human Resources, or you can give access to your entire organization. The
content pack can be customized with a title, and a description to help users determine if the content pack
is applicable to their needs. You can also upload an image or company logo for the content pack. You can
choose the reports, dashboards, and datasets you want to include; however, when you choose a report or
dashboard, it automatically includes any required datasets, and these cannot be excluded. The content
pack is then available in your organization’s content gallery. Users who have access to the content pack
can create new dashboards from the contents.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 2-17
Furthermore, you can import content packs from SaaS providers such as Adobe Analytics, AlpineMetrics
Sales Prediction, Insightly, Marketo, and Twilio. To add a content pack from an SaaS provider that you
have an account with, click Get Data then under Services, click Get. In the Microsoft AppSource window,
under Apps, either click the SaaS logo to view provider details, or click Get. You will be prompted to enter
your customer details for the service. After authentication, you can import a content pack with reports
and dashboards designed to visualize your data without you needing to do any work.
Q&A Box
The Q&A box sits at the top of the screen when viewing dashboards. When you click in the box, Q&A
displays a prebuilt list of suggestions to help you get started. This list comprises the questions that were
used to create the tiles that were pinned to the dashboard, in addition to the names of the tables in the
datasets that were used to build the report. You can select any of the suggestions from the list, or type in
your own question. Q&A helps you phrase your question, using auto-complete, restating your questions,
and using appropriate textual or visual aids. It also corrects spelling and dims the color of words it does
not understand.
Terminology
Q&A automatically recognizes the following keywords and terms:
Names. If a column in the dataset contains a phrase such as "name", for example FirstName, then
Q&A knows the column values are names. You can phrase a question using the search for a particular
name.
Aggregations. Minimum, maximum, count of, average, less than, between, before.
Question: Discuss the benefits of using Power BI in an organization looking to create reports
to analyze their data.
Demonstration Steps
1. In Power BI Desktop, on the Home ribbon, click Publish.
3. In the Power BI Desktop window, enter the email address for your Microsoft account, and then click
Sign in.
4. In the Sign in to your account window, enter the password for your Microsoft account, and then
click Sign in.
5. The report will then be published to the Power BI portal. When the window displays Success, click
Open 'Adventure Works Sales.pibx' in Power BI to view the report online.
6. When the browser opens, click Sign in, enter your email address and password, Sign in, and wait for
the report to open in Internet Explorer.
8. In the Pin to dashboard dialog box, click New dashboard. Type Adventure Works Sales in the box,
and click Pin live.
9. In the upper left, click Show the navigation pane. The dashboard will appear under the Dashboards
list.
13. In the Description box, type Top 10 selling products, and then click Upload.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 2-19
14. In the Choose File to Upload dialog box, navigate to D:\Demofiles\Mod02\Demo\Demo, click
content_pack.png, and then click Open.
15. Under Dashboards, select Adventure Works Sales. The Reports and Datasets are automatically
added, and then click Publish.
Note: The organizational content packs are a Power BI Pro feature, and so are unavailable
to the standard trial accounts.
16. Click Get Data, and then click My organization. The content pack appears in the list under My
organization.
MCT USE ONLY. STUDENT USE PROHIBITED
2-20 Introducing Power BI
Objectives
After completing this lab, you will be able to:
Connect to an on-premises SQL Server database from Power BI Desktop, create a new report, and
publish it to the Power BI portal.
Password: Pa$$w0rd
2. Run Setup.cmd in the D:\Labfiles\Lab02\Starter folder as Administrator. You may receive a prompt
asking whether you want to close SQL SERVER LAUNCHPAD. If so enter Y.
Results: After this exercise, a report will be published on the Power BI portal.
2. Pin the LineTotal by Product chart to the Adventure Works Sales dashboard.
3. Pin the Annual Sales and Annual Revenue chart to the Adventure Works Sales dashboard.
2. Change the size of the SalesYTD chart to span the width of the above charts.
2. When in the full screen mode, use the Fit to Screen feature to remove excess space and fill more of
the screen.
3. Click a chart and use the Focus mode to display and zoom in on a single tile.
4. Use Pin visual to create a new dashboard from the current dashboard.
Results: After this exercise, a dashboard will be created on the Power BI portal.
Question: Self-Service BI empowers business users with the ability to use corporate data to
compile reports without the dependency on an IT department, or a dedicated report
developer. Giving users access to live data means they can gain insights into the most up-to-
date transactions. Real-time analysis is critical to organizations in certain industry sectors.
While this is advantageous to the users, you must consider the security and performance of
your on-premises databases. What tools can you use to ensure the safety and performance
of your databases?
Question: Discuss the different SaaS providers that your organization uses, and how this
data could be used in Power BI dashboards. How could this data be combined with data
from production databases to create greater insights into data?
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 2-23
Module 3
Power BI Data
Contents:
Module Overview 3-1
Module Overview
Power BI offers a straightforward approach to report creation, and the ability to create and share
dashboards without dependency on a report developer, or the need for Microsoft® SharePoint®.
Microsoft Excel® has long been the tool of choice for data analysts who work in a self-service style.
However, Excel does not offer a quick and easy way to share reports without the use of either SharePoint,
or the creation of multiple copies of spreadsheets that quickly become out of date, or exist outside source
control.
In recent years, four power tools have been added to Excel: Power View, Power Query (known as Get &
Transform in Excel 2016), Power Pivot, and Power Map. Power BI brings much of this power into an
integrated environment in the form of Power BI Desktop. Previously, Excel users have been
inconvenienced by needing to transition between the four power tools, but Power BI Desktop brings the
tools together. This means that Power BI is fast becoming an obvious choice for the analysis and sharing
of data. However, analysts are likely to continue working with Excel for the foreseeable future. Power BI
easily cooperates with Excel, and many other data sources. It’s this ability to create reports rapidly, by
using data from a combination of sources, that really puts the power into Power BI.
Objectives
After completing this module, you will be able to:
Describe the data model and know how to optimize your data within the model.
Use on-premises and cloud Microsoft SQL Server databases as data sources, along with the R script
data connector.
Take advantage of the features of the Power BI service by using Q&A to ask questions in natural
query language, and create content packs and groups.
MCT USE ONLY. STUDENT USE PROHIBITED
3-2 Power BI Data
Lesson 1
Using Excel as a Data Source for Power BI
In this lesson, you will learn how to connect to Excel from Power BI and import data. You will also learn
how to update and refresh data.
Lesson Objectives
After completing this lesson, you will be able to:
Connecting to Files
In Power BI, you can connect to various file formats.
In addition to Excel, you can import data from
comma-separated values (CSV), XML, text, or
JavaScript Object Notation (JSON) files, or a folder
that contains multiple files in one of these formats.
Furthermore, you can import a Power BI report file
that has the .pbix extension. When you import data
directly into the Power BI service, the maximum size
for any file format is 250 megabytes (MB).
When importing CSV files, it’s best to use a comma-delimited format, and include a header row. Fixed
width CSV and text files are also supported. After selecting the file for import, the preview enables you to
select the delimiter type, including comma, colon, semicolon, tab, fixed width, or a custom value.
Local File. Browse to a file that is stored on your local computer. Click Open to upload the data to
Power BI.
OneDrive – Business or OneDrive – Personal. Browse to the file that you want to upload, and then
click Connect. Power BI creates a connection to the file, and updates to the file are automatically
reflected in Power BI.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 3-3
SharePoint – Team Sites. Click SharePoint – Team Sites to open the Connection dialog box. Either
enter the URL of the SharePoint server and click Connect, or just click Connect to view content that is
available to you at the root level.
Note: When you are using a folder location to import multiple files, you can include
different file formats in the folder. After selecting the folder location, Power BI displays a list of
the files that are stored in the folder. This includes any incompatible formats such as .jpg or .docx.
When you click Load to import the data, Power BI ignores the files that it recognizes as not being
data files.
There are several ways in which you can reduce the size of the core workbook in a file that you want to
import. Images and clip art elements can increase the size of the file, so remove these if possible. Remove
cell shading and sheet background colors to further reduce the size. If the report contains a data model,
you can move data from the worksheet to the data model. Furthermore, ensure that you exclude columns
that are not necessary to the analysis that you want to perform. If your data has originated from a data
warehouse, it might include metadata columns that were added during the extract, transform, and load
(ETL) process, such as Last Run Date, or Create Date. Look out for the inclusion of these columns and
MCT USE ONLY. STUDENT USE PROHIBITED
3-4 Power BI Data
remove them where necessary. For more information about creating an efficient data model, see the
following article:
Create a memory-efficient Data Model using Excel and the Power Pivot add-in
http://aka.ms/Ca9lsv
To import data from Excel into a Power BI dataset, the data must first be formatted as a table:
1. To convert columns of data into a table in Excel, first highlight the rows and columns that you want to
include. Then, on the Insert menu, click Table.
2. After you have formatted your Excel workbook, return to Power BI, click Get Data, and then click
Excel.
3. The navigator displays a list of worksheets and tables within the workbook. You can select the
worksheets and tables that you want to import, and then click Load to import these immediately, or
you can click Edit to open the Query Editor to apply transformations.
4. After you have loaded the worksheets into Power BI, you can begin working with them as Power BI
datasets.
Note: If you import an Excel workbook that uses Get & Transform or Power Pivot to
connect to an external data source, you can set up a scheduled data refresh. After the import has
completed, Power BI can use the connection information to make a direct connection to the data
source. The data can then be queried and refreshed, and visualizations are updated.
The process for importing Excel files that contain Power Pivot or Power View content is the same as for a
standard data worksheet. You can import the content into Power BI Desktop or upload it to the Power BI
service from your local computer, or from OneDrive.
Limitations
There are several limitations that you must consider
before publishing to Power BI from Excel:
You must use the same account for Microsoft Office, OneDrive for Business, and Power BI.
Before you publish a workbook, it must contain content that is supported in Power BI; you cannot
publish an empty workbook.
Modern authentication must be enabled. The Publish option is not available on the File menu if
modern authentication is set to disabled.
Publishing a Workbook
If necessary, save your Excel 2016 workbook to OneDrive for Business, open it from this location, click File,
and then click Publish. This gives you two options for uploading your file to Power BI:
1. Upload your workbook to Power BI. If you choose this option, your workbook is displayed as it is in
Excel Online, but you can still pin visuals in your worksheets to dashboards. You will not be able to
edit your workbook in Power BI, but you can click Edit to open the workbook for editing in Excel
Online, or on your computer. The changes are saved to the version on OneDrive. Uploading your
workbook does not create any datasets in Power BI. Workbooks that are uploaded to Power BI have
an Excel icon, to indicate that they are uploaded workbooks. This is the best option if you only have
data in your workbooks, or PivotTables and PivotCharts that you want to view in Power BI. This option
is similar to the Manage and View Excel in Power BI feature in the Power BI service. Click Get Data,
under File, click Get, click OneDrive - Business, and then click Connect.
2. Export workbook data to Power BI. Choose this option if you have a workbook that uses Get &
Transform or Power Pivot to load data into a data model, or if the workbook contains Power View
visualizations that you want to view in Power BI. Unlike the upload option, this option exports any
supported tables and data models into new datasets in Power BI. Power View sheets are converted to
Power BI reports, so you can instantly create dashboards from the visualizations. Furthermore, you
can continue to edit your workbook in Excel. When you save changes, they are synchronized with the
Power BI datasets, usually within an hour. For more immediate results, you can click Publish again to
update the content without having to wait. Reports and dashboards that use the visualizations are
updated. This option is similar to the Export Excel data into Power BI feature in the Power BI service.
Click Get Data, under File, click Get, and then click OneDrive - Business.
When you click Publish, and either the upload or export option, Excel signs in to your Power BI account
by using the credentials for your Office account, and then publishes the workbook. The Publishing to
Power BI status bar displays the progress of the operation.
The structure of the data should stay the same. Renaming or deleting columns that are used in a
report or dashboard will break the dependent visuals.
Power BI ignores any format changes to columns so, for example, you can change a value from 75
percent to 0.75.
New columns are added to the dataset, but they are ignored until they are used in a visual.
When you import whole Excel files from OneDrive for Business or SharePoint – Team Sites, the
changes to the file are automatically reflected in Power BI.
2. Browse to the file that you want to replace, and then click Open to upload the file. Power BI displays
a message to say that you already have a dataset with that name.
Note: If more than one dataset has the same name as the file that you are updating, Power
BI cannot update the dataset until you rename the dataset that is not sourced from the file. There
must only be one dataset with the same name as the file that you want to update.
Data Refresh
The way in which data refresh works in Power BI
depends on the subscription service that you are
using, and the type of data source.
Subscription Types
The options that are available depend on whether
you have a Power BI subscription, which is free of
charge, or a Power BI Pro subscription:
Power BI Pro. Using a Power BI Pro account, you can schedule an hourly refresh, with up to 1 million
rows per hour for streaming data in dashboards and reports by using the Microsoft Power BI REST
API, or Stream Analytics. You can have up to eight hourly data refreshes per day. Furthermore, Pro
accounts include data refresh for live data sources with full interactivity (Azure SQL Database, Azure
SQL Data Warehouse, Spark on Azure HDInsight®), on-premises data sources that require a Power BI
gateway, and on-premises SQL Server Analysis Services that require the Analysis Services Connector.
Database connections in SQL Server Analysis Services use a live connection, which means that they always
display the latest data.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 3-7
After you have created a dataset in the Power BI service, it appears in the My Workspace pane. You can
click the Open Menu icon either to Refresh Now or to schedule a refresh. After running Refresh Now, or
a scheduled refresh, Power BI connects to the data source by using the credentials that are stored in the
dataset. The dataset data is refreshed, and the reports and dashboards that use this dataset reflect the
changes immediately.
A dataset can consist of multiple data sources. For example, in Power BI Desktop, if you acquire data from
an on-premises server running SQL Server, and other data from an Excel workbook, a single dataset is
created when you publish to the Power BI service. However, this dataset contains two data sources that
have connection information to both SQL Server and Excel. Be aware that, when you choose to refresh a
dataset, Power BI connects to all of the data sources in the dataset so that it can refresh the data. This
ensures that all data within reports and dashboards is consistently up to date.
Automatic refresh. Power BI configures the data refresh settings for data sources that can benefit
from an automatic refresh. For example, for files that are loaded from OneDrive, the data that does
not come from an external source is refreshed approximately every hour. Although you can schedule
a refresh to occur more frequently, it is unlikely that this would be necessary.
Refresh Now and scheduled refresh. Refresh Now manually refreshes a dataset, or you can
configure a schedule to run on a regular basis. Use this option for Power BI Desktop (.pbix) files, and
Excel workbooks that connect to on-premises and external online data sources.
Live connection with DirectQuery. If you use DirectQuery, a live connection exists between Power
BI and the data source, such as a database in Azure SQL Database. You always see the latest data
from the source and no manual configuration is required.
For more information about data sources and the refresh options that are available to each type, see the
following article:
Demonstration Steps
Import Data from an Excel File
1. Ensure that the MSL-TMG1, 20778A-MIA-DC, and 20778A-MIA-SQL virtual machines are running,
and then log on to 20778A-MIA-SQL as ADVENTUREWORKS\Student with the password
Pa$$w0rd.
2. In the D:\Demofiles\Mod03 folder, run Setup.cmd as Administrator, and then click Yes when
prompted.
MCT USE ONLY. STUDENT USE PROHIBITED
3-8 Power BI Data
3. At the command prompt to close the SQL Server Launchpad, type Y, and then press Enter.
4. When the script completes, press any key to close the window.
7. In the Get Data dialog box, click Excel, and then click Connect.
8. In the Open dialog box, navigate to D:\Demofiles\Mod03\Demo\Files for Import, click Sales.xlsx,
and then click Open.
9. In the Navigator window, click Sales to show a preview of the data. Use the horizontal scrollbar to
display the columns, select the Sales check box, and then click Load.
10. When the load completes, in the Fields pane, point out the Sales table. Mention that Power BI has
detected columns that can be used in aggregations, as indicated by the Sum symbol next to the
column names.
5. Click Load.
6. In the Fields pane, expand the SalesPerson table to show the columns. Mention that the two tables
from different sources are now available to use together in a report. If the report is published, the
tables will be part of the same dataset.
7. Click File, click Save As, name the report Adventure Works Sales, and then save to the
D:\Demofiles\Mod03\Demo folder.
Which of the following file formats is not a compatible data source in Power BI?
CSV
TXT
XML
SQL
JSON
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 3-9
Lesson 2
The Power BI Data Model
This lesson explores the data model. You will learn how you can use features within the data model to
manage your data.
Lesson Objectives
At the end of this lesson, you will be able to:
Understand how hierarchies can help you analyze your data by drilling down through levels.
Data Types
Data that comes in from a database system such as Microsoft SQL Server is likely to be correctly typed.
However, if you import from other sources, such as CSV, or the web, the data types might need to be
changed. It is a good idea to correct any data types in the model so you can then begin applying the
correct formatting. For example, you can apply formatting to a datetime column to display the data
appropriately for your region, and then use the split column function to extract the day, week, or year
part into a new calculated column.
A wrong data type can cause incorrect results within your visuals. When importing numbers, be cautious
of precision and whether you need precise rounding. If you have financial data that you don’t want to be
rounded down, you can use the Fixed Decimal Number data type, which includes four digits to the right
of the decimal point. This is the same as the Currency type in Power Pivot. Furthermore, if you intend to
include maps within your reports, ensure that address columns have the correct geo category types—for
example, set Country, State, or Region to the corresponding data. After changing any data types that
MCT USE ONLY. STUDENT USE PROHIBITED
3-10 Power BI Data
need altering, it’s good practice to then check that columns that Power BI has set as the default for sort
orders, or aggregating, are correctly determined.
Cross Filtering
When you turn on bi-directional cross filtering in your relationships, this enables the tables in your star
schema to operate as if held in a single table, and you can join and aggregate values between dimension
tables. There is no need for you to flatten your tables, as you can achieve this by changing the cross-filter
type. When you have multiple fact tables, initially start with single direction cross filtering to relate the
tables correctly, before adding bi-directional cross filtering. This method ensures you have your basic
relationships working first, and prevents confusion and ambiguity in your visualizations. You can also use
bi-directional cross filtering to overcome Power BI’s lack of support for many-to-many relationships.
However, you may have a problem creating the relationships you need when you have two fact tables
joined to one or more dimension tables. In this case, you can create calculated tables using existing
dimension tables and then create new relationships. To do this, delete the relationships from one of the
fact tables to the dimension tables, then create new calculated tables using the existing dimension data.
You can then create relationships between these new tables to the fact table from which you deleted the
relationships, and set the cross-filter direction to be bi-directional. The calculated table works the same as
any other table, and is updated when the model is updated, though they will increase the size of your
model.
Primary Keys
A primary key column uniquely identifies each row
within a table. At the end of a relationship, one of
the tables must contain unique values. A primary
key is frequently created using a surrogate key,
particularly in a database. A surrogate key is usually
a sequential number, starting at 1, and
incrementing by 1, for each row that is added to the table. A surrogate key uses information that is not
actually business data. However, business data can be used and an Employee table, for example, might
have a primary key column based on the social security number, which uniquely identifies each employee,
as shown in the following table:
If another employee named Lucinda Smith joins the organization, she can be uniquely identified because
the data in the SocialSecurityNo column will differ from the data stored for the existing Lucinda Smith. In
many cases, data will not have a natural key. If you have a Category table, the data is likely to be a list of
category names, which will not necessarily be unique. To make them unique, we add a surrogate primary
key column named CategoryID, as shown in the following table:
CategoryID Category
1 Frozen Food
2 Pet Supplies
3 Dairy
Each time a new category is inserted into the table, the CategoryID number is incremented. The primary
key forces uniqueness within the table, and becomes the basis for foreign keys.
Foreign Keys
Foreign keys enforce data integrity by ensuring that the data table in one table is correctly related to data
in another table. Furthermore, it prevents rows in the primary key table from being deleted, leaving
orphaned records in the foreign key table. For example, a SubCategory table has a SubCategoryID
primary key column to uniquely identify each subcategory; it also includes a CategoryID foreign key
column to the Category table, which acts as the parent within the relationship. This relationship can be
seen in the following table:
MCT USE ONLY. STUDENT USE PROHIBITED
3-12 Power BI Data
1 1 Ice Cream
2 1 Sorbet
3 2 Dog Treats
4 2 Dog Food
5 2 Cat Food
6 3 Cheese
The relationship between the tables enables you to work with the data as if it was one table:
6 3 Dairy Cheese
The Frozen Food category cannot be deleted from the Category table, because there is at least one
related table in the SubCategory table. If the category was deleted, the child records in the SubCategory
table would have incomplete data that would not make for useful reporting. Furthermore, by using
relationships, this prevents repeated data. In the above table showing the data joined from the Category
and SubCategory table, each Category name is repeated for the corresponding row in the SubCategory
table; however, it only exists once in the Category table. This is important when data is updated, as only
one row requires altering.
Creating Relationships
You use relationships to work with data as if all the related tables were a single table. For example, if your
Product table is related to the SubCategory table using a SubCategoryID column, you can display the
product name from the Products table alongside the subcategory name from the SubCategory table. The
SubCategory table then joins to the Category table making the data appear seamless in your reports, and
enabling users to slice data.
When you import data into the data model, Power BI detects existing relationships. When you connect to
a relational database such as SQL Server, the data is most likely to be related already, and Power BI
detects the existing connections between the tables to create the relationships. However, if you import
two tables with a common column but without a relationship, Power BI is likely to detect the commonality
and still create a relationship. For example, if you have two tables named Department and Manager,
each containing a DepartmentID column, even though there is no relationship between the tables,
Power BI works out that the columns and data match, and automatically creates the relationship.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 3-13
If you drag fields onto the report canvas to combine with other data in a visual, Power BI checks to see if
the data is related and can be combined. If it can’t relate the fields, a warning message appears, and you
can click to choose whether you want Power BI to autodetect the relationships between the fields, or to
manually create a new relationship.
Viewing Relationships
You can view and manage the relationships within your data model by clicking on Relationships on the
left-hand side of the Power BI Desktop window. This displays your tables diagrammatically, and you can
instantly see how one table relates to another. Furthermore, you can move the tables around while
maintaining the links between them, so they are easier to understand. If you have many tables within your
model, you can use the zoom feature to zoom in or out and see a closer view of the tables and columns.
The Fit to Screen button lays out the tables so you can see all tables and relationships in a single view on
the screen. After moving your tables around, you can use the Reset Layout button to return to the
default layout.
Before you begin adding visuals to your report and hooking up the data, ensure you have correctly
established the relationships, because this facilitates the ability to present accurate data.
Hiding Fields
It’s a good idea to hide fields that you know you are not going to use in your visuals. Hiding a field
removes the field name from the Fields pane, and neither the column nor the underlying data is deleted.
To hide a field, right-click the field in the Fields pane, and choose Hide. Right-click anywhere on a table
or field to open the menu and choose View hidden, so hidden fields reappear in the list of fields, and
show in their original position in the order of the fields. Hidden fields are shown in grey text to indicate
their hidden status. You can also select Unhide all to make hidden fields visible again. If you switch to the
data view, you will see that hidden columns also display with the column header and data in grey text.
Sorting Data
If you drag a column such as DayOfWeek, or MonthName to a column chart visual to display sales
figures, the values are automatically ordered alphabetically. However, it’s unlikely you want the data to be
ordered in this way, and require the columns to be in day or month order, rather than by name. From the
Sort group on the Modeling ribbon, click Sort By Column. When you select a column from the Sort By
Column list, you will see that Power BI has selected one column as the default for the sort, so when this
best guess is incorrect, it is quick and easy to change. Choose another column, such as DayNumber, or
MCT USE ONLY. STUDENT USE PROHIBITED
3-14 Power BI Data
MonthNumber, so the columns are ordered correctly. For example, rather than showing as April, August,
December, and so on, month names now appear as January, February, March, and so on. This makes data
analysis much easier as the user can read the data in the correct time order.
Note: This ability to sort data is also applicable to other items you usually refer to in a
specific order, such as product categories, projects, or departments. When working with visuals,
try to present data in the optimum way for enabling the end user to quickly digest the presented
information.
Formatting Data
Changing data types and formatting data are good ways of optimizing your data. When you drag a
datetime or currency field onto the report canvas, you might find the style of the date is not easy to read,
or not in your local formatting, or that sales figures display without a currency symbol. From the
Formatting group on the Model tab, you can select the Data type and Format menus to customize your
data. Power BI enables menu formatting items that are relevant to the data type of the column that you
highlight in the Fields pane. You may wish to change a data type first, and then change the available
formatting options. You can format how datetime data types are displayed, as well as setting financial
columns to always include your local currency symbol. This presents the data with clarity in your reports
and dashboards.
Country
State/Province
City/Town
Street
House Number or House Name
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 3-15
Time Intelligence
If you have date columns in your data that you have used in a report in Power BI, you might have noticed
that the ability to drill through has been created for you. Power BI automatically splits date data into:
Year
Quarter
Month
Day
If you drag a date column to the axis field bucket of a visual, you can see this in action, because you can
immediately start drilling into the data over time. You can use DAX time intelligence functions to
aggregate your data over different time periods. DAX is covered in detail in Module 5 of this course, but if
you would like to find out more information, see the following article:
Creating Hierarchies
You use hierarchies to drill down into your data. By
creating custom hierarchies, you can drill through
levels applicable to your data, to support your exact
analytical requirements. Furthermore, you can add
multiple hierarchies to a table in your data model.
Use the following steps to create a new hierarchy:
3. Click the ellipsis on the column where you want to add to the hierarchy at the next level down. Select
Add to hierarchy, and select the name of the hierarchy. If you have already created a hierarchy, it
will be listed in the menu.
4. Repeat step 3 for each column you want to add to the hierarchy.
5. If you have added a column incorrectly, you can click it in the hierarchy and select Delete, or you can
drag the column and move it up or down in the hierarchy to reposition it. You click a field in the
hierarchy and right-click to Rename.
After you have added all columns to complete the hierarchy, you can drag the hierarchy to the Axis field
bucket, such as on a column chart. You will see the data aggregated for the values in the top level of your
hierarchy. To begin drilling down into the lower layers, click the Click to turn on Drill Down single arrow
icon in the top right-hand corner of the visual to enable drill down capability. When you click a data
point, the visual drills into the next level in the hierarchy. In the left-hand corner of the visual, the title
shows the levels in the hierarchy the data is displayed for—for example, using an address hierarchy that
might be Sales by Country and State. When you drill into the next level, this becomes Sales for
MCT USE ONLY. STUDENT USE PROHIBITED
3-16 Power BI Data
Country, State and City. You can see which filters have been applied in the Filters list. This is particularly
useful for hierarchies with deeper levels.
Above the title are further buttons you can use to traverse the data. Click the Drill Up button to move up
one level in the hierarchy. Use the button with two down arrows, Go to the next level in the hierarchy,
to navigate to the next level down, without filtering on data, so you don’t have to click a data point and
drill into one value within a level. When the data cannot be drilled into any further, the button is disabled
and displays At the lowest level of data.
The Expand all down one level of the hierarchy button enables you to expand the hierarchy: for
example, with a hierarchy of Country, State, City, at the State level, rather than clicking into each state to
see all sales for every city, you can expand to see all values at the next level. So if the visual currently
displays all states within the United States that have sales data, rather than clicking into each state to see
all the cities, use the Expand all down one level of the hierarchy button to show sales for every state
and every city.
In the Axis field bucket, click the X icon to remove a level in the hierarchy; for example, click to remove
State, and navigate from Country directly to City. To add levels back into the hierarchy, click Show all
levels. You can achieve the same result by clicking the check boxes in the hierarchy in the Fields pane.
You can also right-click a data point and select Exclude to remove it from the visual. You can include or
exclude values using Filters.
Furthermore, you can add filters to the columns included in the hierarchy, hide columns, and create new
measures and columns, so the hierarchy is fully customized for your reporting requirements.
Demonstration Steps
Creating a Hierarchy
1. In the Fields pane, under Sales, right-click Country, and then click new hierarchy. The new hierarchy
column is added.
2. Right-click Territory, point to Add to Hierarchy, and then click Country Hierarchy.
3. Right-click State Province, point to Add to Hierarchy, and then click Country Hierarchy.
4. Right-click City, point to Add to Hierarchy, and then click Country Hierarchy.
5. Right-click Country Hierarchy, click Rename, type Region Hierarchy, and then press Enter.
6. In the Fields pane, under Sales, drag the Total Due column to the report canvas to create a new
chart.
8. Resize and move the chart on the canvas so it fills the report canvas.
9. In the Fields pane, under Sales, click the Total Due column to give it focus.
10. On the Modeling ribbon, click Format: General, point to Currency, and then click $ English
(United States).
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 3-17
Using a Hierarchy
1. In the top right-hand corner of the chart, click Click to turn on Drill Down. Notice that the arrow
icon is now black.
2. Click the United States column in the chart to show the data by Territory. Notice that the chart title
has changed.
3. Click the Northwest column, and again, notice that the chart title changes.
4. Click the Oregon column. Notice that the title of the chart has changed, and the down arrow in the
top left-hand corner is disabled.
7. Click the Expand all down one level in the hierarchy icon to see the Total Due by Country,
Territory, and State Province.
Question: Discuss some of the different data sources that you might use in your
organization to import data into the data model in Power BI. What problems would you
need to overcome? How easy would it be to relate the data in tables from different sources?
How easy do you think it would be to use data from the web within your model?
MCT USE ONLY. STUDENT USE PROHIBITED
3-18 Power BI Data
Lesson 3
Using Databases As a Data Source for Power BI
In this lesson, you will learn how to connect to on-premises and cloud instances of SQL Server, SaaS
connectors, the R script data connector, and other data sources.
Lesson Objectives
At the end of this lesson, you will be able to:
Describe other data sources that are compatible with Power BI.
SQL Server
Microsoft SQL Server is a popular relational
database management system (RDBMS). Unlike
Microsoft Access, which is designed for a single user
or very small company, SQL Server can handle
multiple user connections, high volumes of
transactions, and scales from the smallest to largest
of databases. SQL Server can run in the cloud, but
on-premises instances remain widespread,
particularly in medium to large enterprises. The
steps for connecting to SQL Server from Power BI
are much the same as connecting to other database
systems, such as Oracle, MySQL, and IBM DB2.
2. Click SQL Server. This opens the SQL Server database connection dialog.
3. Type the name of the SQL Server instance into the Server text box. If more than one instance is
running on the server, you might need to type in <servername>\<instancename>.
4. Optionally, you can type the name of the database you want to connect to in the Database text box.
If you don’t include this, you will connect using the default database associated with your account.
However, if you expand Advanced options and want to use a query to return data, you will need to
specify the name of the database in the Database text box.
5. Click OK.
6. If you have chosen to use a query, you will see a sample of the results in the next window. Otherwise,
you can select tables and views from the list to see a preview of the data. To import data, select each
table and view what you want to include.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 3-19
7. Optionally, you can click Select Related Tables to import data from any tables that have a
relationship to the one you have selected. This feature is particularly useful for fact tables that
comprise multiple foreign key relationships to dimension tables.
8. After selecting the tables that you want to import, click Edit to load the data and begin working on it
in the Query Editor; or choose Load, and return to the main Power BI window. In the Connection
settings window, you can choose to Import the data into Power BI, or use DirectQuery, which does
not import the data. DirectQuery is useful for very large databases that are likely to import big
datasets that would be slow to work with. If you are uncertain, leave Import selected, and click OK.
After your data has been loaded into the Power BI data model, you can begin shaping and transforming
the data, and applying other optimizations.
SaaS Connections
You can connect to an increasing number of SaaS
providers to import data from the third-party online solutions that your organization uses. From Power BI
Desktop, you can import data from different SaaS providers and combine the data in reports and
dashboards. For example, you could create a report that showed marketing data from Facebook and
MailChimp campaigns, combined with the resulting sales that used data from Salesforce. SaaS providers
include, but are not limited, to:
Microsoft Bing®
Google Analytics
Intuit QuickBooks
MailChimp
Microsoft Exchange
Active Directory®
Salesforce
Marketo
GitHub
Zendesk
MCT USE ONLY. STUDENT USE PROHIBITED
3-20 Power BI Data
Other Databases
Power BI includes support for the main industry databases for importing data. Database connectors
include:
Microsoft Access®
Oracle
IBM DB2
MySQL
SAP HANA
PostgreSQL
Sybase
Teradata
1. On the ribbon menu, click Get Data, and then click Web.
2. Type or paste the webpage address into the URL box, and then click OK. If you have previously
created a parameter, Power BI gives you the option to use a parameter value for the URL. Power BI
imports the structured data, and ignores page titles and text.
1. On the Home ribbon, click Enter Data to open the Create Table window.
2. Right-click, and then click Paste to copy in data from the file. The table is then created within your
dataset, and you can work with it just as you do with other tables. If you include column headers,
Power BI detects these and uses them as the column headers in the new table. You can also manually
enter data and add columns.
3. In the Name box, type the name of the table, and then click Load.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 3-21
Installing R
To run R scripts from Power BI Desktop, you must install a local instance of R. For further information
about downloading and installing R Services, see the following article:
Only data frames are imported, so all of the data that you want should be included in the data frame.
The time-out for the query is limited to a maximum of 30 minutes. The script stops executing if it has
to wait for user input.
Complex and Vector type columns cannot be imported, and will be replaced with error values in the
table.
When you set the working directory of the R script, you must use a full path, not a relative path.
1. Open Power BI Desktop, and then on the ribbon menu, click Get Data.
2. In the Get Data window, click Other, click R Script, and then click Connect.
3. Type or paste your script into the script box, and then check that the location where the R script is
installed is correct—for example, C:\Program Files\Microsoft\MRO\R-3.2.2.
4. If you have multiple installations, select the one that you want or explicitly provide the full location,
and then click OK.
MCT USE ONLY. STUDENT USE PROHIBITED
3-22 Power BI Data
R Script Options
You can also manage your R installations on the Options and settings menu:
1. In Power BI Desktop, click File, click Options and settings, and then click Options.
2. Click R Scripting, select your R home directory from the list, and then click OK. The option that you
choose here is then used as the default in the R script data connector.
Demonstration Steps
Import Data from SQL Server
1. On the Home ribbon, click Get Data, and then click SQL Server.
2. In the SQL Server database dialog box, in the Server box, type MIA-SQL, in the Database
(optional) box, type AdventureWorks, and then click OK.
3. If you are prompted to enter your credentials, ensure the Windows tab is selected, click Use my
current credentials, and then click Connect. If you see the notice regarding unsupported encryption,
click OK.
4. In the Navigator window, select Sales.vSalesPerson to preview the data, and ensure the box is
selected.
5. Select Sales.vStoreWithDemographics to preview data, and ensure the box is selected, and then
click Load.
If the Connection settings window appears, leave Import checked, and then click OK.
1. On the Home ribbon, click Get Data, and then click SQL Server.
2. In the SQL Server database dialog box, in the Server box, type MIA-SQL, in the Database
(optional) box, type AdventureWorks.
3. Expand Advanced options, and in the SQL statement (optional, required database) box, type
SELECT * FROM [Production].[Product], and then click OK.
4. In the MIA-SQL: AdventureWorks window, a preview of the data is displayed. Click Edit.
5. In Query Editor, in the ProductSubcategoryID column, click the filter icon, and then click Remove
Empty.
6. In the Queries pane, right-click Query1, click Rename, type Products, and then click Close & Apply.
Verify the correctness of the statement by placing a mark in the column to the right.
Statement Answer
True or false? You can use the Power BI Q&A natural language to ask
questions of your data when using DirectQuery.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 3-23
Lesson 4
The Power BI Service
This lesson explores some of the advanced features in the Power BI service, including how to use natural
query language with Power BI Q&A to ask questions of your data, create content packs to share
collections of dashboards and reports, and how and why you would want to create a group.
Lesson Objectives
After completing this lesson, you will be able to:
Configure your data to use the Q&A feature to ask natural language questions in dashboards.
Q&A searches structured data, and can work on any Excel workbook that you upload. However, upfront
data cleaning and optimizations can help to boost the performance of Q&A, and deliver the answers that
you need. Consider the names that you give to your entities. For example, if you have a table named
Internet Sales, columns named Category, Product, Units Sold, Cost Price, Gross Sales, Month, and
Year, and a calculated column named Profit, you can see how easy it is to find answers to questions such
as, “What were the sales last year by category and month?” Furthermore, Q&A understands how to filter,
sort, aggregate, and group data, which you can include in your question, so you could ask, “What were
last year’s sales by month sorted by profit?” By being clear in your naming conventions, you can see how
Q&A can more easily deliver answers to your questions.
MCT USE ONLY. STUDENT USE PROHIBITED
3-24 Power BI Data
Note: The Power BI Q&A natural language only works with cloud-based datasets that have
been uploaded to the service, so you cannot use it with an on-premises tabular model in SQL
Server Analysis Services.
When you publish a content pack, you choose who you want to give access to. You can choose specific
groups, such as sales or human resources, or you can give access to your entire organization. The content
pack can be customized with a title and a description to help users to determine whether the content
pack is applicable to their needs. Furthermore, you can upload an image or company logo for the content
pack. You choose the reports, dashboards, and datasets that you want to include, but when you choose a
report or dashboard, it automatically includes any required datasets, and these cannot be excluded. The
content pack is then available in your organization’s content gallery. Users who have access to the content
pack can create new dashboards from the contents.
You can import content packs from SaaS providers such as Adobe Analytics, Alpine Metrics Sales
Predictions, Insightly, Marketo, and Twilio. To add a content pack from an SaaS provider with whom you
have an account:
2. Click the provider’s SaaS logo, and then click Connect. You will be prompted to enter your login
details for the service.
3. After you have been authenticated, you can import a content pack that contains reports and
dashboards that have been designed to visualize your data without you needing to do any work.
Note: Only users who have a Power BI Pro subscription can create and share content packs.
You do not need a Power BI Pro account to view content packs from your organization, or from
SaaS providers.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 3-25
Creating a Group
You can create a group in Power BI Pro or Microsoft
Office 365™. Both methods enable users to share
information, communicate, and collaborate. After
you create a group, you can invite members to join
the group and share the group workspace. This
workspace enables members to collaborate on the
dashboards, reports, and datasets that are specific
to the group. Group administrators can give
permission to members to allow them to make
modifications, or grant read-only access. The group
functionality extends to Office 365 group services,
including sharing files on OneDrive for Business,
and Exchange calendars, tasks, and conversations.
Note: Dashboards, reports, and datasets can be shared with colleagues outside the group,
which is the same process as sharing a dashboard from My Workspace.
Creating a Group
To create a group:
1. Sign in to the Power BI service, and then click the arrow next to My Workspace.
2. In the expanded pane, next to GROUP WORKSPACES, click Create group.
3. In the Name your group box, type the name of the group. Power BI checks whether the name is
available.
4. Under Privacy, select Private - Only approved members can see what's inside, or Public -
Anyone can see what's inside.
5. Choose the level of access that users will have—Members can edit Power BI content or Members
can only view Power BI content.
6. In the Add group members box, type the email address for the first colleague who you want to
invite, and then click Add. Repeat this step for each member, or paste a list of email addresses from
Microsoft Outlook®. As each member is added, the email address is shown in a list. An invitation is
emailed to each colleague and, after they have accepted, you can set their membership to Admin or
Member. If a colleague has not yet created a Power BI account, the email invites them to join. You
can also remove members from the group.
7. Click Save to finish. The group is listed under My Workspace, and members who have edit
permission can add content to the workspace.
Editing a Group
Only group administrators can alter the group settings and change membership options. Administrators
see an ellipsis next to the group name in My Workspace. Click the ellipsis to open the menu, and then
click Edit Group. This opens the same form that was used to create the group, so from here, you can
change the name of the group. You can update the privacy settings, add or remove members, and switch
membership levels between Admin and Member.
MCT USE ONLY. STUDENT USE PROHIBITED
3-26 Power BI Data
Collaborating
Your role within a group determines whether you can make modifications to the content. Click the name
of the group in the navigation pane, or click My Workspace to expand the navigation pane, and then
click the name of the group. This displays the group starting page, and you can begin working with
content packs, or import data, or click Skip for now to go the group workspace. Here you will see
dashboards, reports, workbooks, and datasets that have been added to the group. Click Create to add a
new dashboard, report, dataset, or streaming dataset. If you choose to create a new dataset, you can only
select from cloud sources such as Azure SQL Database, or on-premises SQL Server Analysis Services
tabular models. You can use Power BI alongside Office 365 to share files on OneDrive for Business,
engage in conversations in Exchange, and share calendars, and tasks.
Demonstration Steps
Ask a Question by Using Q&A
3. In the Power BI Desktop dialog box, enter the email address for your Microsoft account, and then
click Sign in.
4. In the Sign in to your account dialog box, enter the password for your Microsoft account, and then
click Sign in.
5. The report will then be published to the Power BI portal. When the window displays Success, click
Open 'Adventure Works Sales.pbix' in Power BI to view the report online.
6. When the browser opens, click Sign in, enter your email address and password, click Sign in, and
then wait for the report to open in Internet Explorer.
8. In the Pin to dashboard dialog box, click New dashboard, type Adventure Works Sales in the box,
and then click Pin live. If the Introducing Featured dashboard message appears, click Got it.
9. Click Show the navigation pane, under Dashboards, click Adventure Works Sales.
10. Click in the Ask a question about your data box, and then point out the list of tables and fields that
automatically appears.
11. Type sales person. Q&A returns a list of suggestions. Select sales person by city and the table is
reordered.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 3-27
12. In the Q&A box, type show company name and unit price as pie chart. When the chart is visible, in
the top-right of the report, click Pin visual.
13. In the Pin to dashboard dialog box, leave Existing dashboard selected, and then click Pin.
14. Click unit price to highlight it, and then scroll down the list of suggestions in the Q&A box, to show
how Q&A is picking up the columns from the dataset to create suggestions.
15. Click Show the navigation pane, under Dashboards, click Adventure Works Sales. Scroll down the
dashboard if necessary, to display the new charts on the dashboard.
17. In Power BI Desktop, in the Publishing to Power BI window, click Got it, and then close Power BI
Desktop.
Question: How could your organization use content packs and groups? What are the major
advantages of content packs and groups?
MCT USE ONLY. STUDENT USE PROHIBITED
3-28 Power BI Data
Objectives
After completing this lab, you will be able to:
Alter an Excel file to reduce its size, and then import the data into Power BI Desktop.
Password: Pa$$w0rd
2. On the Product Category worksheet, change the names of the columns to user-friendly versions.
6. On the Product Subcategory worksheet, change the names of the columns to user-friendly versions.
10. On the Products worksheet, change the names of the columns to user-friendly versions.
11. Change the cell style to normal.
18. Convert the Unit Price, Unit Price Discount, Line Total, and Total Due cells to the US dollar
currency type.
19. Change the name of the table to Sales.
2. Upload the Adventure Works Data.xlsx file that you formatted in the previous task.
3. Notice that the table and column names match the names of the tabs and columns in Excel.
Results: After this exercise, the data in Excel will be available as a dataset in Power BI Desktop.
MCT USE ONLY. STUDENT USE PROHIBITED
3-30 Power BI Data
Results: At the end of this exercise, the Power View report will be available as a Power BI report.
Question: Discuss the different data sources that your organization could use to create
Power BI reports. Can you think of a scenario where users perhaps have Excel workbooks for
one set of reports, and reports in SQL Server Reporting Services for another set of data?
Could this be combined into a single dataset in Power BI?
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 3-31
Review Question(s)
Question: Discuss the different ways in which Power BI could reduce your organization’s
dependency on shared Excel files. How would having a central location for data, reports, and
dashboards benefit different departments? How could each department make use of
features such as content packs and the natural query language in Q&A?
MCT USE ONLY. STUDENT USE PROHIBITED
MCT USE ONLY. STUDENT USE PROHIBITED
4-1
Module 4
Shaping and Combining Data
Contents:
Module Overview 4-1
Module Overview
Power BI Desktop offers a self-service solution for creating visual, interactive reports and dashboards.
Users can connect to a wide variety of data sources, combing data from on-premises databases, Software
as a Solution (SaaS) providers, cloud-based services, and local files such as Microsoft Excel®, into one
report. The beauty of Power BI reports and dashboards is the ability to rapidly build reports to present this
data so it is instantly readable—with clusters, outliers, and patterns in data visually brought to light. To
achieve this, each report must have a dataset comprising tables and columns that are ready to add
straight into visualizations. Data must be formatted for relevant currencies, numbers should have correct
decimal places, additional columns and measures might be required, and data may have to be combined
from multiple tables. With Power BI Desktop, you can do all of this, with powerful, built-in tools for
shaping your data. This module introduces the tools that are available for preparing your data, and
transforming it into a form ready for reporting.
Objectives
After completing this module, you will be able to:
Lesson 1
Power BI Desktop Queries
In this lesson, you will learn about the tools in Power BI that shape and transform your data, so that it is
ready to use in reports. You will also explore the main features of the Advanced Editor.
Lesson Objectives
After completing this lesson, you will be able to:
Roll back your data shaping steps using the Applied Steps feature.
Change the code that Power BI uses to query the data sources.
Home
You can import data from the Query Editor using New Source, Recent Sources, or Enter Data, in the
New Query group. These offer the same functionality as the Get Data, Recent Sources, or Enter Data
options in the main Power BI design window.
In the Data Sources group, click Data Source Settings to change the properties of the data source. You
cannot edit the query, but you can change the server and database, in addition to the login details.
Furthermore, you can choose to encrypt the connection and set the security level.
You use the Parameters group to manage and create parameters that can be used in a variety of ways
within the report. Click Manage Parameters to edit the properties and data values of your parameters, or
delete a parameter. Use Enter Parameters to select the current values for each of the parameters within
the report. To add a new parameter, click New Parameter. You can explicitly specify the values for the
parameters, or use a query, in addition to setting the data type and determining whether a value must be
supplied.
The Query group includes a function to refresh the preview data for the current table, or all tables in the
dataset. Click Properties to edit the name of the query, and the optional query description, and to
configure whether to Enable load to report, and Enable refresh of this query. Click Advanced Editor
to view and edit the query code.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 4-3
With the Manage Columns group, you can hide columns in your query using the Choose Columns
function. You can also add them back in later if they are required. Remove Columns hides the currently
selected column(s).
Use the Reduce Rows group to keep or remove rows from the query. By using Keep Rows, you can keep
the top or bottom specified number of rows, or use Keep Range of Rows, by entering the First row as
the starting row, and then Number of rows. All other rows are removed. Remove Rows gives you the
option to remove the top, or bottom specified number of rows, alternate rows, or blank rows. You can use
Remove Duplicates to delete rows with identical values in one or more columns. You can also choose to
Remove Errors, or Keep Errors.
The Sort group provides options for sorting data from A-Z or Z-A. You can apply a sort to multiple
columns in a query, though you should always start with the column that has the least unique values. For
example, apply the sort in order of Country, Region, and then City.
For quick access, you will find the most common transformations on the Transform group. These are also
included on the Transform tab.
The Combine group provides functions for merging and combining data between queries. You can use
Merge Queries to combine columns, or use Append Queries to combine rows.
Transform
The Table group on the Transform tab includes a Group By function with which you can create a new
column by applying an aggregation function to an existing column. This group includes Use First Row As
Headers, which is useful when importing data and Power BI has not detected that the first row contains
the header. Transpose converts columns into rows, and rows into columns; Reverse Rows reorders the
rows so that the last rows are at the top, inverting the order of the data. Count Rows returns a count of
rows in the table.
The Any Column group functions can be applied to all columns in your table, regardless of data type.
You can change the data type of columns, rename columns, replace values, and errors, and use the Fill
function to fill empty cells with a neighboring value, going up or down. You can also move, pivot, and
unpivot columns.
With the Split Column function in the Text Column group, you can split one column into one or more
columns, based on a delimiter. This is very useful for extracting concatenated strings.
The Structured Column group gives you options for working with nested data such as tables or lists. The
Expand function promotes nested data to become columns or rows in the top-level table. Aggregate
summarizes data from a nested structure to reveal average, minimum, maximum, and count values.
The Run R Script function on the Scripts group enables you to run R queries directly in the editor. You
must have R installed to use this function.
The rest of the items included on this tab are covered next.
Add Column
You can use the Add Custom Column button to create a new column using a formula. A list of available
columns to work with is included, and the syntax checker ensures your formula is correct before applying
to create the new column. You can use the Add Index Column button to create a new index column on a
table. The index can be an incremental value, starting at 1, and incrementing by 1, and you can also set
the starting value to be 1 or 0. With the custom index column, you can set the starting value and
increment to any value. You can also duplicate columns using existing values, applying built-in string
functions such as uppercase, lowercase, or capitalizing each first letter.
MCT USE ONLY. STUDENT USE PROHIBITED
4-4 Shaping and Combining Data
You can use Conditional Column to add a column based on the values in another column. For example,
if you have a Title column, and wanted to create a new Gender column, you could specify that if the value
in the Title column was Mr, then the value in the new Gender column would be Male—for all other values,
it would be Female. Instead of explicitly specifying the comparison value of Mr, you could choose a
parameter to supply this value. If you create the new column based on a date or datetime column, you
can use the date picker for the comparison value. Data can also be cleaned and trimmed, and you can
add a suffix or prefix. You can extract a substring from a column value to create a new column, and parse
JSON, and XML column data into columns.
You can use the From Number group to apply statistical, standard, and scientific functions to numerical
columns. Statistical functions include aggregations such as sum, minimum, maximum, and average; you
can also count values and distinct values. Standard functions you can apply include add, subtract, multiply,
and divide. The scientific functions include absolute value, square root, exponent, and factorial. You can
also apply trigonometry, rounding, and information such as Is even, or Is odd.
The From Date & Time group offers useful functions for extracting dates, times, and durations from
existing datetime columns. You can create a new column by extracting the year, month, day, or quarter
from a value, and compare two columns to extract the date or time difference.
View
With the View tab, you can show or hide the Query Editor settings. These settings include the name of
the query, or table, and the list of Applied Steps, which are the transformations performed on the query.
From here, you can also open the Advanced Editor window to view and edit the query code. You can also
show or hide the Formula Bar, and toggle displaying the data as monospaced, and whether to show or
hide white space.
Note: When you click a column in the Query Editor, Power BI determines the data type
from the values, and enables the relevant features on the tabs, so you can only apply formatting
to columns with applicable data. You can use Determine Data Type to run automatic data type
detection against select columns.
Applied Steps
When you shape your data using Query Editor,
Power BI saves a list of the transformations you
applied to your data, such as rename a column,
delete a column, or change a data type. This list is
retained in the Applied Steps of the Query Settings.
Each time you connect to the data source to run
the query, Query Editor applies these steps to the
data, so it is always presented exactly how you
shaped it.
If you click the gear icon to the right of Source, this opens the connection dialog box. For example, if your
connection is to an Azure SQL Server database, click Source to open the connection dialog box. This
shows the server name and database, and the code if you entered a query. If you included a query at this
stage, no Navigation step is included. However, if you did not include a query, and instead selected from
a list of available tables and views, you can use Navigation to change the source table or view.
Reordering Steps
You can change the order of the steps in the Applied Steps list, but you must be careful that this does not
break the query. For example, if you move the step Renamed Columns above Navigation, you will break
the query, so be aware of the dependencies between the steps. To move a step, right-click the step in the
Applied Steps pane, and choose Move Up, or Move Down, or drag the step.
Deleting Steps
You can delete steps in the list, effectively rolling back and undoing an action, but only if there are no
later dependencies on the steps. If the step is isolated and has no later transformations that are
dependent on the previous step, you can probably delete it. This is a useful, fast method for undoing
transformations such as removing a column that you later realize you have to include. To remove a step,
click the X to the left of it.
Undoing Steps
In addition to undoing deleted columns, if you hide a column using the Choose Column option, you can
click the gear icon to the right of a step, and it opens the list box that was used for selecting the column
you wanted to hide. You can then select or clear columns.
Inserting Steps
You can add a transformation to an existing step. If you already have a list of steps, one of which was
renaming a column, followed by a number of other transformations, you can click the Renamed Columns
step to highlight it, and then choose another column to rename. Query Editor will ask you to confirm that
you want the new step to be inserted into the existing step.
Renaming Steps
Each step in the list is given a generic name, such as Removed Column, Removed Other Columns1,
Removed Duplicates. This is not helpful if you have a long list of steps and want to go back and make
adjustments to the order, or roll back a step. However, you can rename a step. In the Applied Steps pane,
right-click a step, and select Rename. Type in the name of the step; for example, CustomerID renamed
Customer Code. Providing sensible names for your steps helps you make future amendments, and also
assists colleagues with whom you share queries, as they see which transformations have been applied.
MCT USE ONLY. STUDENT USE PROHIBITED
4-6 Shaping and Combining Data
Best Practice: Providing sensible names for the steps in your queries helps if you return to
the data after a long time, and have forgotten exactly what transformations were applied. This is
particularly helpful if you want to stop halfway through shaping your data, and return later. You
can see the list of transformations, and pick up from where you finished before. This will be
helpful if you share the query with colleagues.
You can also add a description to each of the steps. Right-click a step and choose Properties to open the
Step Properties dialog. In the Description box, type in the description of the transformation, and click
OK. When you hover your mouse over the steps in the Applied Steps pane, a tooltip displays the name of
the step and the description.
Advanced Editor Query to Return Unfiltered Data from the SalesLT.SalesOrderDetail Table
let
Source = Sql.Database("sqlazure.database.windows.net", "AdventureWorksLT"),
SalesLT_SalesOrderDetail = Source{[Schema="SalesLT",Item="SalesOrderDetail"]}[Data]
in
SalesLT_SalesOrderDetail
When you make transformations to your data in the Query Editor, the steps are saved to the Applied
Steps in the Query Settings. These steps are also applied to the code in the Advanced Editor. For example,
the following code shows the steps that have been applied to the SalesOrderDetail query. First, the
SalesOrderDetailID column was removed, and then the OrderQty column was renamed Order Quantity.
Finally, the rowguid and ModifiedDate columns were removed.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 4-7
The following code shows the connection to the AdventureWorksLT database on Azure, with filtering
applied using the Query Editor:
Advanced Editor Query to Return Filtered Data from the SalesLT.SalesOrderDetail Table
let
Source = Sql.Database("sqlazure.database.windows.net", "AdventureWorksLT"),
SalesLT_SalesOrderDetail = Source{[Schema="SalesLT",Item="SalesOrderDetail"]}[Data],
#"Removed SalesOrderDetailID" =
Table.RemoveColumns(SalesLT_SalesOrderDetail,{"SalesOrderDetailID"}),
#"Rename OrderQty" = Table.RenameColumns(#"Removed SalesOrderDetailID",{{"OrderQty",
"Order Quantity"}}),
#"Removed rowguid and ModifiedDate" = Table.RemoveColumns(#"Rename
OrderQty",{"rowguid", "ModifiedDate"})
in
#"Removed rowguid and ModifiedDate"
The transformations in the code reflect the order in the Applied Steps—these must be in the correct order
when run against the data source. You can alter the code in the Advanced Editor, but you should use the
syntax checker to ensure you do not break the code.
Delete steps, and change the source table in the Navigation step.
Demonstration Steps
1. If it is not already running, start the MSL-TMG1, 20778A-MIA-DC and 20778A-MIA-SQL virtual
machines, log on to 20778A-MIA-SQL as ADVENTUREWORKS\Student with the password
Pa$$w0rd.
4. In the Get Data dialog box, click Microsoft Azure SQL Database, and then click Connect.
5. In the SQL Server Database window, in the Server box, type the URL of the Azure server <Server
Name>.database.windows.net (where <Server Name> is the name of the server you created), and in
the Database box, type AdventureWorksLT, and then click OK.
7. In the Username box, type Student, in the Password box type Pa$$w0rd, and then click Connect.
9. On the Ribbon, in the Query group, click Advanced Editor. The window opens to display the query
code. Note that no transformations have been applied yet. Click Cancel.
11. In the Applied Steps list, right-click Removed Columns, and click Rename. Type Removed
SalesOrderDetailID, and then press Enter.
MCT USE ONLY. STUDENT USE PROHIBITED
4-8 Shaping and Combining Data
12. In the center pane, right-click the OrderQty column, and click Rename. Type OrderQuantity, and
then press Enter.
13. In the Applied Steps list, right-click Renamed Columns, and click Rename. Type Renamed
OrderQty, and then press Enter.
14. In the center pane, click the rowguid column, and with the Ctrl key held down, click ModifiedDate.
15. Right-click either of the column headings, and then click Remove Columns.
16. In the Applied Steps list, right-click Removed Columns, and click Rename. Type Removed
rowguid and ModifiedDate, and then press Enter.
17. On the Ribbon, in the Query group, click Advanced Editor. The window opens to display the query
code. Note that the transformations have been added, and they are in the same order as the list of
Applied Steps. Click Cancel.
18. In the Applied Steps list, right-click Removed rowguid and ModifiedDate, and click Move Up.
19. In the Applied Steps list, click the delete icon next to Removed SalesOrderDetailID.
20. In the Delete Step dialog box, click Delete. The SalesOrderDetailID column reappears in the table.
21. In the Applied Steps list, click the gear icon next to Navigation.
22. In the Navigation window, select SalesLT.SalesOrderHeader, and click OK. Note that the data
preview has been updated with the SalesLT.SalesOrderHeader data. Also note the warning icon
under Queries [1].
23. In the Applied Steps list, click the delete icon next to Removed rowguid and ModifiedDate.
27. On the Ribbon, in the Query group, click Advanced Editor. The window opens to display the query
code. Note that the transformations have been removed, and the source table has been changed.
Click Cancel.
28. On the Ribbon, click Close & Apply to return to Power BI Desktop.
The Navigation step only shows if you have selected tables or views from the
data source, instead of using a query.
You can move a step between the Source step, and the Navigation step.
MCT USE ONLY. STUDENT USE PROHIBITED
4-10 Shaping and Combining Data
Lesson 2
Shaping Data
This lesson explores the powerful features in Power BI with which you can shape your data ready for use
in reports. You will learn how to shape your data, by applying formatting to make your data better for
Power BI to handle in visuals, and how to apply transformations.
Lesson Objectives
After completing this lesson, you will be able to:
Describe how data shaping makes your data easier for reporting.
Format your data so that Power BI manages it correctly within charting visuals.
Transform your data using techniques such as adding new columns and changing data types.
Renaming Columns
Your columns should have names that make it easy to work with them when creating reports and viewing
dashboards. Each column name should give the data in that column an adequate description. This is
particularly relevant when working with datasets containing several tables and columns—it makes it easier
to find the right fields to add to report visuals. Power BI Q&A, which uses the natural query language, also
returns more accurate results if it can find the data needed to answer the question being asked of it.
Data Types
The Query Editor makes a best guess at the data type of each column when loading in the data. It is a
good idea to check the given column types are as you would expect, and then format any that are
incorrect. This can be critically important for decimal columns, where changing the data types between a
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 4-11
decimal and a whole number could potentially give false results in calculations. Currency columns that
don’t contain a currency symbol in the source are not typed as currency, so checking these columns and
formatting them as your local currency will give better results in aggregations—in addition to formatting
the data so it presents better in data labels.
Datetime Columns
Datetime columns should also be formatted with the correct data type. You can use the Date and Time
transformations to add additional columns to extract the year, quarter, month, week, and day from a date
column, and hours, minutes, and seconds from a time column. You can calculate the difference between
two data columns to create a new column. For example, you could subtract the Delivery Date from the
Order Date to create a Days to Fulfill column, showing how long it took to deliver an order after it had
been placed. If you have a Date of Birth column, you can use the Age function to create a new column
for the person’s current age.
Adding Columns
There are many options and functions to help you create new columns in your queries. You can duplicate
an existing column, split a column into multiple columns, use the data and time functions described
above, or concatenate values in multiple columns to create Full Name, or Full Address fields. You can also
use math functions to create calculated columns; for example, to subtract Manufacturing Costs from Retail
Price to create Profit. Data from a date column can be merged with data from a time column to create a
new datetime column.
Adding Indexes
You can add indexes to your tables, with the seed value starting at 1 or 0, or you can create a custom
index by defining the start number, and the increment. If you combine data from different systems, you
may find that there are overlaps in the index key columns, meaning you wouldn’t have unique values
when merged together. In the Query Editor, you can add an index as a surrogate key column to the two
tables you are appending, so the index value is always unique.
Formatting Data
By formatting your data, you help Power BI
categorize and identify the data, making it much
easier to work with. Applying string functions to
your text columns to create consistency ensures
that data is presented well.
General Formatting
The General Formatting group includes the Add
Custom Column function. You enter a custom
formula to create the new column, including
calculations using values from other columns. The
syntax checker indicates when you have an error,
and does not allow you to save a formula with
MCT USE ONLY. STUDENT USE PROHIBITED
4-12 Shaping and Combining Data
errors. To create a new column, click Add Custom Column. In the New column name box, type the
name of the column, and add your formula to the Custom column formula box; for example,
[ShipDate] - [OrderDate]. Select a column from the Available columns list, and click Insert, or double-
click to add it to the Custom column formula text box. When you are finished, click OK. The new column
is appended to the table, and the formula is visible in the Formula Bar. If you open Advanced Editor, you
see that this formula is appended to the query.
The following example shows the code in the Formula Bar, which subtracts the OrderDate from the
ShipDate to return the number of days as the new column DaysOrderToShip.
The following code is the formula to create a custom column, which calculates the days from when the
order was placed to when it shipped:
The column is created with a data type of Any, and values are in the format of 7:00:00:00. To change the
type, right-click the column and choose Change Type, and then select the appropriate type. In this
example, the data was converted to a Whole Number type.
The Add Index Column function appends the index to the end of your table. You can start the index at 1
or 0, or choose the starting value. By default, the index increments by 1, but you can change this using the
custom index option. To add an index, select Add Index Column from the General Group. Select From 0,
From 1, or Custom. If you choose From 0, or From 1, the index is added immediately. If you choose
Custom, this opens the Add Index Column dialog box. In the Starting Index box, type your starting
number; for example, 100. In the Increment box, type the number you want the index to increase by with
each row; for example, 10. The index in this case would be 100, 110, 120, 130, and so on. It is common
practice to have your index as the first column in the table, so right-click the new index column, and
choose Move, To Beginning. You can also select multiple rows to move them together.
The Duplicate Column function is useful when you have a string column that will be split, but you want
to retain the original value. You can click to select the column, and choose Duplicate Column from the
General group, or right-click and select Duplicate Column. The new column is appended to the end of
the table, and given a name such as SalesOrderNumber - Copy. You can then work with this column to
split the values, or perform other operations, such as replacing substrings or trimming repeated
characters.
Formatting Text
The From Text group functions provide options for formatting string values, merging columns, extracting
values and parsing to other formats. The Format function converts strings to lowercase, UPPERCASE,
Capitalize Each Word, Trim, Clean, Add Prefix, and Add Suffix. You can use these to convert your
string data into consistent formats, which is particularly helpful when importing raw data that has not
been cleaned. If you import data from an e-commerce website, where customers have entered their
names and addresses, and no formatting was applied before the data was saved to the database, it is
likely to be inconsistent—with mixed casing across the various fields. You can use Capitalize Each Word
so the columns all have the correct casing, and apply UPPERCASE to state codes, such as MA, NJ, WA, or
country, or area names depending on your reporting requirements.
You can create a new column by merging two or more columns together. To do this, click to select a
column, and hold down the Ctrl key and click the other columns you want to merge. On the From Text
group, click Merge Columns. In the Merge Columns dialog box, choose how you want the values to be
separated, from Colon, Comma, Equals Sign, Semicolon, Space, Tab, or Custom. For Custom, enter the
symbol or character, such as a dash. In the New column name (optional), give your column an
appropriate name, and click OK.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 4-13
Note: The columns values are concatenated in the order in which you click the columns to
select them. This gives you full control over the end result.
Best Practice: The Merge Columns function can be used on address fields to quickly create
a full address column. Highlight your address columns in order, and click Merge Columns. For
the separator, choose Custom, and enter “, ” (comma and a space). This concatenates all the
values together in a comma separated list.
However, you are likely to have null values or empty strings in some columns, perhaps Address2,
which results in double commas. You can use the Replace Values function on the Any Column
group of the Transform tab, to replace “, ,”, with “, ”.
You use the Extract function to copy a substring value from one column, to create a new column. You can
also use Extract to count the length of a string. Select a column in your table, and click Extract from the
From Text group. Click Length to create a new column that counts the number of characters in the
column. Spaces are included in the length. To extract a fixed number of characters from the beginning or
the end of the column value, use First Characters, or Last Characters. Select the column and click Extract,
and then either First Characters, or Last Characters. Enter a value for the Count, and click OK. This is
useful if you want to split a PostalCode column to extract the first few characters to create a map based
on area, rather than exact postal code. To extract a specific number of characters from the middle of a
string, you use Range. Select the column, and click Extract, Range. Provide a Starting Index, and a
Number of Characters value, and click OK. If you type 2 for the Starting Index, the extract starts on the
third character.
The Parse function takes a column that is an XML or JSON format, and parses it into a table. Select the
column with your XML or JSON data, and click Parse from the From Text group. Select XML, or JSON,
and the Query Editor adds a table column to the current table. Click the double-arrow icon to expand the
new table, and choose the attributes you want to include in the table. This is a very quick way to parse
and extract data provided in XML or JSON format.
Formatting Numbers
There is a wide range of formatting functions that you can apply to your numeric columns. The From
Number group includes functions for Statistics, Standard, Scientific, Trigonometry, Rounding, and
Information. This section focuses on the more common standard number functions. Choose from Add,
Multiply, Subtract, Divide, Divide (Integer), Modulo, or Percentage.
Add
To Add two or more columns together, click the first column, hold the Ctrl key, and click the other
columns. On the From Number group, click Standard, Add. This creates a new column with a default
name of Sum. You can also add a whole or decimal number to a column. Select a single column, and then
click Standard, Add. Enter the number that you want to be added to the existing column value.
Multiply
If you want to multiply two or more columns together, click the first column, hold the Ctrl key, and click
the other columns. On the From Number group, click Standard, Multiply. This creates a new column
with a default name, Multiply. To multiply a column by a whole or decimal number, select a single
column, and then click Standard, Multiply. Type the number that you want the existing column value to
be multiplied by. For example, to calculate a net value to include 20 percent tax, click the net column,
click Standard, Multiply, and type 1.2. This creates a column with the additional tax amount.
MCT USE ONLY. STUDENT USE PROHIBITED
4-14 Shaping and Combining Data
Subtract
Subtract works in much the same way as the Add, and Multiply functions; however, you can only use two
columns in the calculation. Select the first column you want to use in the calculation, and then click the
column to subtract from the first column, and click Standard, Subtract. This creates a new column named
Subtract by default. If you wanted to use more than two columns, you could use a custom column, with a
formula such as [RetailPrice] - [ManufacturingCost] - [StoreCommission]. You can also select a single
column, click Standard, Subtract, and then enter a whole or decimal number.
Note: The order in which you select your columns affects the calculation. For example, if
you want to calculate Profit, click RetailPrice, click ManufacturingCost, and then click
Standard, Subtract. The calculation is displayed in the Formula Bar, so if you have incorrectly
ordered the columns, you can manually change the query. In this case, the query
Table.AddColumn(#"Changed Type", "Profit", each [ManufacturingCost] - [RetailPrice],
type number) is incorrect, because the ManufacturingCost should be subtracted from the
RetailPrice.
Divide
The Divide function can also only operate on two columns, and you should be aware of the order in which
you select them, because this affects the calculation. Select the first column for the calculation, hold down
the Ctrl key, and then click the second column for the number to divide by. Click Standard, Divide—a
new column is created and by default is named Divide. This returns a whole or decimal value. You can
divide a single column by a specific value. Click the column, and then click Standard, Divide, and enter a
whole or decimal number. Click OK. This creates a new column named Inserted Division by default.
Transforming Data
While Power BI is flexible in the variety of data
sources, you can import data from, visualizations
work best with data that is in a columnar format.
For example, data that is imported from Excel may
be easy for the human eye to digest visually, but
the data might not be structurally appropriate for
Power BI to translate the values in a bar chart. The
Query Editor offers plenty of functions for you to
transform data into a structure that Power BI can
use effectively in reports. This lesson explores the
functions available on the Transformations tab.
Table
The Table group offers some useful functions that you can quickly use to transform your data. Each of the
functions is described next.
Group By
You can aggregate one or more columns in your table. Click Group By on the Table group, and select the
columns you want to include. Ensure you include all columns that you want to include in the table, or they
will be removed. In the New column name box, give the column a useful name, and choose the
Operation from Sum, Average, Median, Min, Max, Count Rows, Count Distinct Rows, or All Rows. If
the operation such as Sum requires a column to aggregate, select this from the list, and then click OK.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 4-15
This function is useful when data has been imported and it already has a header row, but Power BI has not
detected this. If you import columns with numeric values that include a header, Power BI can detect that
the first row is a string compared to the other values—and guess that it is the header. This is not so
obvious when all of the columns contain string values. To apply this function, click Use First Row As
Headers, and select Use First Row As Headers. The values of the first row are promoted to the column
header. You can also perform this operation in reverse. Click Use First Row As Headers, and select Use
Headers As First Row. The headers become the first row in your table, and you can then rename the
columns.
Transpose
With Transpose, you can treat rows as columns, and columns as rows. This is useful if you import a table
from a spreadsheet with columns and rows that are readable to the user in a matrix format, but don’t
translate into a format that Power BI can use easily. Select the table that you want to apply this function
to, and then click Transpose from the Table group. You can then begin applying other functions, such as
unpivot, to give your data a columnar format.
Reverse Rows
This function reverses the order of the rows in the table, so that the bottom rows are at the top, and the
top rows are at the bottom.
Count Rows
Use this function to return the number of rows in the current table. The rows are replaced with the count
of rows.
Any Column
The functions in the Any Column group can be applied to columns, regardless of the data type or format.
Each of the functions is described next.
Data Type
You can use the Data Type function to select from a list of data types—this is useful for converting
columns where Power BI has incorrectly guessed the type. Select one or more columns in the table, click
Data Type, and then select the data type for your conversion. Types include Decimal Number, Fixed
Decimal Number, Whole Number, Date/Time, Date, Time, Date/Time/Timezone, Duration, Text,
True/False, and Binary.
You can select one or more columns and use the built-in data type detection function. Select a column,
hold down the Ctrl key, and then click any additional columns you want to add. From the Any Column
group, select Detect Data Type. Power BI automatically corrects any columns it guesses to be wrong.
Rename Columns
To rename a column, select the column in the table, and then click Rename Column from the Any
Column group, or you can right-click the column and then click Rename. Type in the new name of the
column, and press Enter—the name is updated.
MCT USE ONLY. STUDENT USE PROHIBITED
4-16 Shaping and Combining Data
With these two functions, you can very quickly replace a value in a column, or replace an error in a
column, with another value. Both functions work on one or more columns, so select a single column, or
hold down the Ctrl key to click and select multiple columns. Click Replace Values from the Any Column
group, and in the dialog box, type a Value to Find, and a value to Replace With. Click Advanced
Options if you want to Match entire cell contents and/or Replace using special characters. Special
characters include Tab, Carriage Return, Line Feed, and Carriage Return and Line Feed. Click OK. The
values in the column are replaced. To replace an error, click Replace Errors instead of Replace Values, and
type a replacement value in the Value box of the Replace Errors dialog box.
Fill
You can use the fill function to fill in null values with the value from an adjacent cell. Click the cell you
want to use to fill the adjacent cells, and click Fill, and then select Fill Up, or Fill Down, depending on
which direction you want to fill. This works at the column level.
The Pivot Column takes the values in the selected column, and uses them to create new columns. This is
particularly helpful if you import data that has a matrix format from Excel, and you want to convert it to a
columnar format for reporting. Unpivot can also help with this, by converting selected columns into
attribute-value pairs.
Move
The Move function moves one or more columns to another location in the table. Click the column you
want to move, or hold down the Ctrl key to select multiple columns, and click Move from the Any
Column group, or right-click. You can move Left, Right, To Beginning, or To End. The To Beginning
option is useful if you add in an index column, because this is always appended to the right.
Split Column
The Split Column function splits a column based on a delimiter, or a specified number of characters.
Much like the Extract function discussed in the previous lesson, you can select from the list of delimiters,
or use a custom delimiter. To split a column, select the column in the table, and from the Text Column
group, select Split Column. Click By Delimiter, to open the Split Column by Delimiter dialog box. You
can select a delimiter from Colon, Comma, Equals Sign, Semicolon, Space, Tab, or Custom. To use a
custom character, select Custom, and enter the character, or symbol, such as a hyphen. You can split At
the left-most delimiter, At the right-most delimiter, or At each occurrence of the delimiter. The
number of new columns that are created will depend on which split option you choose.
To have further control over the split, click Advanced options. You can specify the number of columns to
split into, and the Quote Style, which is CSV, or None. You can also split using special characters, and
choose from Tab, Carriage Return, Line Feed, and Carriage Return and Line Feed. Click OK. The
column splits the values, and the original column is replaced. Use the Duplicate Column function on the
Add Column tab if you want to retain this value.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 4-17
Demonstration Steps
1. If Power BI Desktop is not already open, click Power BI Desktop on the taskbar. Click Get Data if the
Get Data dialog box displays.
3. In the Get Data dialog box, click Excel, and then click Connect.
4. In the Open dialog box, browse to the D:\Demofiles\Mod04\Demo folder, click Sales Matrix.xlsx,
and then click Open.
5. In the Navigator dialog box, select Sales, and then click Load.
6. When the data has finished loading, on the Ribbon, click Edit Queries, and from the drop-down list,
click Edit Queries.
7. In the Untitled - Query Editor dialog box, in the Queries pane, click Sales.
10. Click the table icon in the top left-hand corner of the table, and click Use First Row As Headers.
11. Right-click the Column1 column, click Rename, type Country, and then press Enter.
12. Right-click the Column2 column, click Rename, type Category, and then press Enter.
13. Click the Country column, and on the ribbon, in the Any Column group, click Fill, and then click
Down. The null values are replaced.
14. Click the 2005 column, hold down the Ctrl key and click the 2006, 2007, and 2008 columns.
15. Right-click any of the selected column headers, and then on the ribbon, in the Any Column group,
click Unpivot Columns.
16. Note that the names of the columns are Attribute and Value for the attribute-value pairing.
17. Right-click the Attribute column, click Rename, type Year, and then press Enter.
18. Right-click the Value column, click Rename, type Sales, and then press Enter.
19. On the File menu, click Close & Apply.
20. In the Fields pane, expand Sales, click Country to select the field.
21. On the Modeling ribbon, click Data Category: Uncategorized. Select Country/Region.
22. In the Fields pane, note the map icon next to Country.
23. In the Fields pane, under Sales, click Sales to select the field.
24. In the Formatting group, click Data Type: Text, and click Fixed Decimal Number.
26. Click Format: Currency General, click Currency, and then select $ English (United States).
MCT USE ONLY. STUDENT USE PROHIBITED
4-18 Shaping and Combining Data
27. In the Fields pane, note the sum symbol next to Sales.
28. Drag the Country field onto the report. Note that Power BI automatically chooses the map chart.
29. Drag the Sales field onto the map, and note that the bubble sizes now represent the Sales figure.
36. Grab the corner edge of the chart to expand the width and height.
37. Click the Click to turn on Drill Down arrow icon in the top right-hand corner of the chart.
38. Click the tallest column in the Bikes group. This now breaks down the sales by year.
Save the file report as AdventureWorks Sales.pbix to D:\Demofiles\Mod04\Demo, as this will be used
for the next demonstration.
Which of the following is not good advice for shaping your data?
Remove all columns and rows that are not used in the reports.
Rename columns to provide names that represent the column data, and can be
used by Power BI Q&A.
Let Power BI guess the data types of your columns because it will always be
correct.
Create an index column if you want to guarantee the sort order in a visual, or if
you are appending data.
Use the Age function on a Date of Birth column to calculate the current age.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 4-19
Lesson 3
Combining Data
In this lesson, you will learn how to import using an Internet address as a data source, how to shape that
data, and how to merge it with existing data in your dataset.
Lesson Objectives
After completing this lesson, you will be able to:
Importing Data
To import data from a webpage, open Power BI Desktop. From the Getting Started dialog box, or from
the Home tab, click Get Data, and select Web. In the From Web dialog box, type or paste the web
address into the URL box, and click OK. Power BI establishes a connection to the webpage, and
determines the data that can be imported. In the Navigator dialog box, you are presented with a list of
tables for the data that can be imported. You can select the tables and preview them as you would any
other data source. Click Edit to load the data into Query Editor and begin shaping the data. Alternatively,
you can click Load to import the data into Power BI designer, where you can use it immediately in
visualizations, or later apply transformations and shaping.
Note: Public websites such as Wikipedia offer a wealth of information that you can freely
use in your reporting. However, you should be aware that you have no control over when the
data is updated, whether or not it is accurate, or even if the page or data is retained or removed.
MCT USE ONLY. STUDENT USE PROHIBITED
4-20 Shaping and Combining Data
It is also important to ensure the name of the query (table) is something obvious, and the same applies to
the column’s name. Again, this keeps clarity within the dataset, and has the added advantage that you or
other colleagues can understand the data just by looking at the names of the queries and columns.
Furthermore, Power BI Q&A uses the natural query language and relies on being able to find answers to
questions, based on relevant column names. The names should accurately describe the data.
When importing the data, the Query Editor makes a best guess at the data types for each of the columns.
You will want to check the columns to ensure the type matches the data. Check that datetime columns
have been detected correctly, especially if you want to use dates and times for drill-down. The Query
Editor does not always recognize currencies unless there is a symbol included in the data—you should
update any currency columns. Check that numerical columns have the correct data types, and include
whole numbers and decimals, which you require for aggregations.
If the data needs a particular sort order, you can set this to be A-Z, or Z-A, or add the month number to a
query that includes month in text format—so you can order on the numeric value in your visualizations.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 4-21
Merging Data
By using Power BI, you can gather data from
different sources, and of different types, into a
single dataset. The data can then be combined in
one report. You can import data from SaaS
providers such as Bing, and Salesforce, combine it
with data from your Azure SQL Database in the
cloud, an on-premises SQL Server Analysis Services
(SSAS) data warehouse, and with data from Excel.
After importing into a single set of data, you can
merge columns using tables from different sources,
and append rows.
Merging Columns
To merge columns, the two tables must have a joining column, where the value will match the order to
combine the values. From the Power BI Desktop designer, click Edit Queries to open the Query Editor
window. Click the query (table) into which you want to merge the other columns. From the Home tab,
select Merge Queries from the Combine group. This opens the Merge dialog box. The top table is the
one you elected as the destination table for merging the second table into. Click to choose the column
you want to join on. You can select more than one column by holding the Ctrl key down while using your
mouse to select. In the list, select the table you want to merge from. In the second table, click to select the
column, or columns, you are joining. The label at the bottom of the dialog box counts the matches, so
you can usually determine if the match is correct. For example, if you are expecting all rows to match, and
the label says, “The selection has matched 36 out of the first 48 rows”, then something is wrong.
You can choose the type of join used to connect the two tables, by selecting from the Join Kind list.
Types of join include Left Outer (all from first, matching from second), Right Outer (all from second,
matching from first), Full Outer (all rows from both), Inner (only matching rows), Left Anti (rows only in
first), or Right Anti (rows only in second). Use the default Left Outer, or select another join, and click OK.
The second query is merged as a single column, with a value of Table. Click the double-arrow icon in the
column header, and select the columns you want to include from the second table. You might not want to
include the joining column, if all your rows matched or partially matched as expected. Clear the Use
original column name as prefix if you want the columns to keep their original names, otherwise the
column is named NewColumn.<original name>. After making your selection, click OK. The second table
columns now appear as columns in the first table—though you may need to rename them.
Appending Rows
When you append rows, you take rows from one or more tables, and add them to the first table. In most
situations, the columns and data types will match. However, you can append rows between two tables
that have all different columns—but the result is unclean data, and no values when the number of
columns between the tables does not match. From Power BI Desktop designer, click Edit Queries to open
the Query Editor window. Click the query (table) into which you want to append the rows, and click
Append Queries from the Combine group on the Home tab. This opens the Append dialog box. From
the Select the table to append list, choose the table you want to add in, and then toggle Two tables, or
Three or more tables. If you are appending two tables, click OK. If you have clicked Three or more
tables, in the Available Table(s) list, select each table you want to append, and click Add. You can
append a table to itself if you have to. Click OK.
MCT USE ONLY. STUDENT USE PROHIBITED
4-22 Shaping and Combining Data
Best Practice: If you are appending rows from multiple sources, and the table contains
index values that overlap when the data is combined, combine the data, and then create a new
index column on the table into which the rows have been appended.
Demonstration Steps
1. If Power BI Desktop is not already open, click Power BI Desktop on the taskbar. If the Get Data
dialog box displays, click Get Data. In the Navigator window, click Web, and click Connect.
2. If Power BI Desktop is already open, on the Home tab, click Get Data, click Web.
3. In the From Web dialog box, in the URL box, type http://www.imdb.com/chart/top, and then click
OK.
8. Note that these steps have been grouped together in the Applied Steps list as Removed Columns.
9. Click the Rank & Title column, and then on the Home tab, in the Transform group, click Split
Column, and then click By Delimiter.
10. In the Select or enter delimiter list, select --Custom--, and type a period (.) in the box.
11. In the Split section, click At the left-most delimiter, and then click OK.
12. The Rank data now shows in its own column. Right-click the Rank & Title.1 column, click Rename,
type Rank, and press Enter.
13. Click the Rank & Title.2 column, and on the Transform ribbon, in the Any Column group, click
Replace Values.
14. In the Replace Values dialog box, in the Value to Find box, type (, and then click OK.
15. With focus on the Rank & Title.2 column, from the Any Column group, click Replace Values.
16. In the Replace Values dialog box, in the Value to Find box, type ), and then click OK.
17. With focus on the Rank & Title.2 column, in the Text Column group, click Split Column, and then
click By Number of Characters.
19. In the Split section, click Once, as far right as possible, and then click OK.
21. Right-click the Rank & Title.2.1 column, click Rename, type Title, and press Enter.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 4-23
22. In the Text Column group, click Format, and then click Trim. The white space around the titles is
removed.
23. Right-click the Rank & Title.2.2 column, click Rename, type Year, and press Enter.
24. In the Query Settings pane, under Properties, in the Name box, type IMDB Top 250 Movies, and
then press Enter.
26. In Power BI Desktop, on the File menu, click Exit. If prompted to save your changes, click Save.
Which of the following is not a true join type for merging columns?
Objectives
After completing this lab, you will be able to:
Apply formatting to the data you have imported to shape it, ready for reporting.
Combine related data to the shaped data.
Password: Pa$$w0rd
3. If a message asks Do you want to continue with this operation?, type Y and press Enter.
5. In the Navigator window, select North America, and click Edit, to open the Query Editor.
6. Leave the Query Editor window open for the next exercise.
Results: At the end of this exercise, the data will be imported from Excel, and shaped ready to be
combined.
MCT USE ONLY. STUDENT USE PROHIBITED
4-26 Shaping and Combining Data
2. Click Append Queries, and combine the North America data with the Europe data.
3. Use the selection menu on the Country column header to check that the data has loaded.
4. Open the Country Codes.xlsx file in the D:\Labfiles\Lab04\Starter folder, and copy the data.
5. In Power BI Desktop, click Enter Data, and paste in the copied data.
9. Exclude the Territory and Country columns, and clear the Use original column name as prefix
setting.
13. Close Query Editor, close Power BI Desktop without saving any changes, and then close Excel.
Results: At the end of this lab, the Europe and North America data will be appended, and the Country
Code column will be added to the query.
Question: Discuss the types of different data in your organization that could be combined
using the Query Editor. Do you have data stored across locations that could be appended, or
lookup data that could be merged into other tables to make it more useful for reporting?
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 4-27
Review Question(s)
Question: Discuss the benefits of using Power BI, rather than Excel, to shape and transform
your data. Are there any disadvantages? What can Power BI do that Excel cannot, and vice
versa? Which tool do you think is most straightforward to use?
MCT USE ONLY. STUDENT USE PROHIBITED
MCT USE ONLY. STUDENT USE PROHIBITED
5-1
Module 5
Modeling Data
Contents:
Module Overview 5-1
Module Overview
Microsoft® Power BI is making its mark in the self-service BI world—because it can quickly create visually
stunning, interactive reports and dashboards. Power BI provides a straightforward way to combine data
from a wide range of sources into a single dataset, and then work with that data to create cohesive
reports. This module goes behind the scenes of the visualizations, and explores the techniques and
features on offer to shape and enhance your data. With automatic relationship creation, a vast library of
DAX functions, and the ability to add calculated columns, tables, and measures quickly, you will see how
Power BI creates attractive reports, while helping you find hidden insights into data.
Objectives
At the end of this module, you will be able to:
Understand the DAX syntax, and use DAX functions to enhance your dataset.
Lesson 1
Relationships
This lesson explores the relationships between the tables in your data, why they are important, and how to
create them.
Lesson Objectives
At the end of this lesson, you will be able to:
Understand cardinality.
The SalesOrderDetail table is related to the SalesOrderHeader table, shown next. There is one row in the
SalesOrderHeader table for each order, though this order might comprise multiple rows in the
SalesOrderDetail table. The CustomerID column links to the Customers table.
Traversing the tables using the relationships, the SalesOrderDetail table is related to the SalesOrderHeader
table, and the Product table. In turn, the SalesOrderHeader table is related to the SalesOrderDetail table,
in addition to the Customers table. You can use these relationships to view the four tables as one, so you
can see all the products ordered by a customer as if they are in one table. This is useful for aggregating
data across tables in visualizations.
Autodetect Feature
When you import data into Power BI, the Autodetect feature operates in the background, and works out
the relationships in your dataset. It also automatically sets the cardinality and cross filter direction, both of
which are covered as topics in a later lesson. For much of the time, Power BI makes a good guess,
correctly identifying related tables, and creating the relationships for you. In this case, you might not have
to do any further work to establish relationships between the tables.
Viewing Relationships
When you import data into Power BI, queries are
run against the data source to copy the data
required to fulfill your modeling requirements for
the dataset. As these queries are running, Power BI
observes them to determine if there are
relationships between the tables. After the data has
finished loading, you can view and manage the
relationships that Power BI has created for you.
MCT USE ONLY. STUDENT USE PROHIBITED
5-4 Modeling Data
Viewing Relationships
Power BI Desktop comprises three main views: Report, Data, and Relationship. You view the tables and
column names in Report view, and add fields to visualizations. In Data view, you apply extensive modeling
and formatting to the data, and you view the values in the tables. The Relationship view shows the tables
and columns linking together those tables that are related. Click Relationships in the views pane to open
a diagrammatic view of the relationships in your model. The relationships appear the same in the
Relationship view regardless of whether they have been created manually or by Power BI, and all tables
are included, even if they are not related to any others.
You can see information about the relationships, just by looking at the relationship diagram. Each
relationship is represented by a line that joins the two tables. The arrow icon on the line indicates the
cross filter direction of the relationship—either one arrow for Single, pointing in the direction of the filter,
or two arrows when the cross filter direction is set to Both. At the end of each relationship line, where it
joins to either table, another icon represents the cardinality. A star icon (*) represents Many, and a 1
represents One, for either a Many to One (*:1), One to One (1:1), or One to Many (1:*) relationship. When
you click a relationship line, the related columns in either table are highlighted with a black border, for
quick identification.
Editing Relationships
When a relationship line has focus, it is highlighted in yellow. Double-click the line to open the Edit
Relationship dialog box. You can also click Manage Relationships from the Relationships group on the
Home tab, to view the Manage Relationships dialog box. From the Manage Relationships dialog box,
you can create new relationships, run the Autodetect feature, and edit and delete existing relationships. In
the Manage Relationships dialog box, double-click a relationship to open the Edit Relationship dialog
box. This opens the same view as double-clicking a relationship line. In the Edit Relationship dialog box,
you can change the related table and column, switch cardinality between Many to One (*:1), One to One
(1:1), or One to Many (1:*), and toggle the cross filter direction between Single, or Both. You can also
turn on or off the Make this relationship active option. When the Power BI Autodetect feature runs, it
sometimes finds more than one relationship between two tables. In this case, only one of the relationships
is set to active, and this becomes the default relationship. You can use this setting when the active
relationship is incorrect.
You can also delete relationships. Click the relationship line that joins two tables so it is highlighted
yellow. Right-click the relationship line, and select Delete.
Creating Relationships
There are two ways to create relationships in Power
BI. You can use the Autodetect feature and Power
BI works out the relationships for you, or you can
create them manually.
default, also determines the cardinality, cross filter direction, and active relationships. However, bear in
mind that the Autodetect feature is a best guess, and might need adjusting after it runs.
Cardinality
In data modeling, cardinality refers to the
relationship that one table has with another. In
Power BI modeling, the cardinality can be one of
the following three types:
2. One to One (1:1): In a One to One relationship, both tables in the relationship have one instance of a
value. In relational database systems, One to One is not as common as Many to One, and one of its
uses can be to split up larger tables. For example, if you have an Employees table with an EmployeeID
column, and other columns for the employee name, address, date of birth, phone number, and salary.
This data is frequently used by the Human Resources department. You have another table called
EmployeeAdditionalDetails, with a row for each employee, and an EmployeeID column to join to,
from Employees. The EmployeeAdditionalDetails table contains less used fields such as next of kin,
number of dependents, training information, and qualifications. This would be a One to One
relationship.
MCT USE ONLY. STUDENT USE PROHIBITED
5-6 Modeling Data
3. One to Many (1:*): This is the same as Many to One, except the position of the tables is reversed in
the relationship. In this case, you could have your Customers table with one row for each customer,
related to many orders in the Sales table.
Having relationships between your tables prevents the need to flatten the tables, or combine them
together into a single table, before importing the data into the model. Power BI uses an Autodetect
feature to work out the cardinality of relationships, for both those you create manually, and those it has
created automatically. You can change the cardinality by clicking Manage Relationships from the Home
tab. In the Manage Relationships dialog box, double-click a relationship, or click Edit, to open the Edit
Relationship dialog box and select from the Cardinality list to change it. Click OK, and then click Close. In
the Relationships view, double-click a relationship in the diagram to open the Edit Relationship dialog
box. Change the cardinality, and click OK.
Single: With a Single cross filter direction, the filters in related tables operate on the table where the
values are aggregated. If you have imported data from Power Pivot for Excel® 2013 or earlier, all
relationships have Single cross filter direction.
You can manually change the cross filter direction by clicking Manage Relationships from the Home
tab. In the Manage Relationships dialog box, double-click a relationship, or click Edit, to open the Edit
Relationship dialog box and select Both, or Single in the cross filter direction list. Click OK, and then
click Close. Alternatively, in the Relationships view, double-click a relationship in the diagram to open the
Edit Relationship dialog box.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 5-7
Note: The direction of the cross filter is displayed as an arrow for Single, or a double arrow
for Both on the relationship line. The Single arrow points in the direction of the filter.
Demonstration Steps
1. Run D:\Demofiles\Mod05\Setup.cmd as an Administrator, and, in the User Account Control
dialog box, click Yes.
2. When prompted press Y, press Enter, and when the script completes, press any key to close the
window.
4. In the Get Data dialog box, click Get Data. Ensure Excel is selected, and click Connect.
7. Click Load.
9. Point out that Power BI has created the relationships automatically. The layout represents a star
schema.
10. Maximize the tables in the relationship diagram to display all columns.
11. Point out that Power BI has not created a relationship to DimDate from FactInternetSales.
14. In the Create Relationships dialog box, in the top table list, click FactInternetSales. When the table
preview appears below, click the OrderDateKey column.
15. In the bottom table list, click DimDate. When the table preview appears below, click the DateKey
column.
16. Check that the Cardinality is set to Many to One (*:1), the Cross filter direction is Single, and
Make this relationship active is selected, and then click OK.
18. In the diagram, in the FactInternetSales table, click the DueDateKey column. Drag the DueDateKey
column to the DateKey column in the DimDate table. Point out the dotted line to show that the
relationship is inactive. This is because there is more than one related column in the two tables.
MCT USE ONLY. STUDENT USE PROHIBITED
5-8 Modeling Data
19. In the diagram, in the FactInternetSales table, click the ShipDateKey column. Drag the
ShipDateKey column to the DateKey column of the DimDate table. Point out the dotted line to
show that the relationship is inactive.
20. Point out that the relationships from FactInternetSales to DimCurrency, DimProduct,
DimPromotion, and DimSalesTerritory, have a cross filter direction of Both, indicated by the double
arrow icon. These are lookup tables, so should be Single.
22. In the Manage Relationships dialog box, double-click the FactInternetSales (CurrencyKey)
relationship.
23. In the Edit Relationships dialog box, in the Cross filter direction list, click Single, and then click OK.
24. In the Manage Relationships dialog box, double-click the FactInternetSales (ProductKey)
relationship.
25. In the Edit Relationships dialog box, in the Cross filter direction list, click Single, and then click OK.
26. In the Manage Relationships dialog box, double-click the FactInternetSales (PromotionKey)
relationship.
27. In the Edit Relationships dialog box, in the Cross filter direction list, click Single, and then click OK.
28. In the Manage Relationships dialog box, double-click the FactInternetSales (SalesTerritoryKey)
relationship.
29. In the Edit Relationships dialog box, in the Cross filter direction list, click Single, and then click OK.
32. Click the relationship line between FactInternetSales and DimCustomer and press Delete.
36. In the Create Relationships dialog box, in the top table list, click FactInternetSales and in the data
preview, click the CustomerKey column.
37. In the bottom table list, click DimCustomer, and in the data preview, click CustomerKey.
38. In the Cardinality list, click Many to One (*:1), and then click OK.
40. In the diagram, point out that the 1 icon next to FactInternetSales is now a star icon.
41. Click Save, and save the file to the D:\Demofiles\Mod05\Demo folder as Adventure Works
Sales.pbix.
The Power BI Autodetect feature works out the cardinality of the relationship
between two tables.
The Sales table is related to the Customer table using the CustomerID column.
There are many orders in the Sales table for each customer, and one row in the
Customers table for each customer. This is a Many to One relationship.
The Employees table has one row for each employee, and is related to the
EmployeeAdditionalDetails table using the EmployeeID column. There is one
instance of each employee in the EmployeeAdditionalDetails table. This is a One
to One relationship.
Lesson 2
DAX Queries
In this lesson you will learn about DAX, the syntax structure, and how to use functions.
Lesson Objectives
At the end of this lesson, you will be able to:
What Is DAX?
Data Analysis Expressions (DAX) is a formula
language that comprises a library of more than 200
functions, constants, and operators. You use DAX in
a formula or expression, to calculate and return a
single value, or multiple values. DAX is not new—
you may have used it in Power Pivot for Excel, or
SQL Server Analysis Services (SSAS). If you have
used Excel formulas, you will discover some
similarity; however, DAX functions are specifically
designed to work with relational data, which is what
you work with in your Power BI datasets. DAX is
commonly used in calculated columns, and
measures, both of which are covered in more detail in the next lesson.
The following DAX formula returns the sales from last year, using the sales dates for the current year, to
provide a like-for-like comparison:
The key to understanding and using DAX is learning the concepts of the syntax for structuring your
formulas, the functions you can use to make calculations, and context. These concepts are covered in
detail in the remainder of this lesson.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 5-11
Syntax
The DAX formulas that you write must be
syntactically correct, otherwise Power BI gives you a
syntax error message. Therefore, it is important to
understand how to structure your expressions. The
following code shows an example of a typical
formula you might use in Power BI to create a
measure:
The first part of the formula is Total Sales. This example uses a measure, but it could be a calculated
column, and you can rename both in the Report view. The name can contain spaces, in addition to
symbols such as the percentage sign (%). The name of the measure is then followed by the equal operator
(=). The equal operator returns the value of the calculation to the right of it, to the measure, in much the
same way as you assign values to a variable. This example uses the SUM function, and adds up all values
in the argument you pass to it in the parenthesis (). An argument passes a value to the function, and all
functions must have at least one argument. In this case, the argument is the LineTotal column in the
InternetSales table.
When you write your DAX formula, Power BI creates the new measure in the context of the current table.
However, this is completely flexible, and you can move the measure to whichever table you want. Select
the measure in the Fields pane, and then select the Modeling tab. In the Properties group, click Home
Table, and then select the table where you want to move the measure. If you create the above example in
the InternetSales table, you can move it elsewhere without the formula being affected. Because you
passed the table and column name as the argument, this creates independence, because the function
knows exactly which values to operate on, regardless of its home table.
Note: When you refer to a column in a formula, and include the table name, this is known
as a “fully qualified column name”. You can exclude the table name when the measure refers to a
column in the same table in which it also resides; however, it is good practice to include it. While
this can lengthen formulas that reference many columns, it provides clarity and the reassurance
that you are referencing the correct columns—you can also create measures that span multiple
tables, and move them as required.
If your table name contains spaces, reserved keywords, or disallowed characters, enclose the name using
single quotation marks. Table names containing characters outside of the ANSI alphanumeric character
range will also need enclosing with single quotation marks. The column name is always encased with
square brackets; for example, [LineTotal].
You type your DAX formula into the formula bar. There are two buttons to the left of the bar, a cross (X)
icon, and a tick icon. The cross icon cancels the measure, and removes any work without saving. The tick
icon validates your syntax, and enters your new measure into the model.
MCT USE ONLY. STUDENT USE PROHIBITED
5-12 Modeling Data
If you are already familiar with Power BI, you might know that numerical fields are automatically
calculated, and wonder why you would want to create the above measure, because Power BI will sum this
for you. By adding this measure, you can use it as an argument for another formula, meaning you can
create all the calculations you require within your dataset. For more information on DAX syntax, see:
Functions
Functions are predefined formulas that perform
calculations on one or more arguments. As you
learned in the previous lesson, you can pass a
column as an argument, and you can also use other
functions, expressions, formulas, constants,
numbers, text, and TRUE or FALSE values. The DAX
library of more than 200 functions, operators, and
constructs, is segmented into the following 10
categories:
Filter: with filter functions, you can return specific data types, look up values in related tables, or filter
by related values. The functions work by using tables and the relationships between then. Filter
functions include CALCULATE, FILTER, ISFILTERED, RELATED, RELATEDTABLE, and VALUES.
Logical: these functions return information about the value in your expression. Logical functions
include FALSE, IF, IFERROR, NOT, OR, and TRUE.
Math and Trig: similar to the mathematical and trigonometric functions in Excel, math and trig
functions perform a wide variety of calculations. Functions include ABS, ASIN, CEILING, CURRENCY,
DEGREES, EVEN, FLOOR, ODD, PI, ROUND, ROUNDDOWN, ROUNDUP, SQRT, SUM, and TRUNC.
Other: these functions are unique and do not fall into any of the other categories. They include
EXCEPT, GROUPBY, INTERSECT, NATURALINNERJOIN, UNION, and VAR.
Parent and Child: parent and child functions work on data that is presented in a parent/child
hierarchy in the data model. Parent and child functions include PATH, PATHCONTAINS, PATHITEM,
PATHINREVERSE, and PATHLENGTH.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 5-13
Statistical: statistical functions are used to perform aggregations, such as SUM, MIN, MAX, and
AVERAGE. With DAX, you can filter a column prior to aggregating, and create aggregations based on
related tables. Further functions include COUNT, COUNTBLANK, COUNTROWS, CROSSJOIN, MEDIAN,
ROW, SIN, TAN, and TOPN.
Text: text functions operate on string values. You can use them to search for text within a string;
return a substring; format dates, times, and numbers; concatenate strings. Text functions include
CONCATENATE, FIND, LEFT, LEN, LOWER, REPLACE, RIGHT, SEARCH, TRIM, and UPPER.
For a full list of DAX functions, and examples of how to use each function, see:
DAX Function Reference
http://aka.ms/lrf8p9
If you have been using Excel functions, DAX functions may look familiar to you. However, DAX functions
differ in the following ways:
DAX functions reference an entire column, or a table. To use selected values from a table or column
you can include filters in your formula.
If you want to customize a calculation to work on a row-by-row basis, use functions to use the current
row value, or related value as an argument.
If you use one of the DAX functions that returns a table, rather than a single value, the table is not
displayed—it is used to provide input for another function. For example, return a table and count the
values, count distinct values, or filter columns and aggregate the values.
With the time intelligence functions, you can define or select date ranges, and then perform
calculations on them.
Instead of using a VLOOKUP, as you would in Excel, DAX functions accept a column or table as a
reference. In Power BI, you work on a relational data model, so finding values in another table is
straightforward because you can create relationships, and may not actually need a formula.
Context
Context is an important concept to understand if
you want to write expressions that return the results
you expect. In DAX, there are two types of context:
row context, and filter context:
Filter Context: filter context exists in addition to row context. A filter context is one or more filters
applied in a calculation, which determine a single value or result. You can use a filter context to
reduce the values that are included in a calculation. The filter can specify the row context, and also a
particular value or filter, in that row context. Filter contexts select subsets of data. If you have a
visualization in your report that includes Sales, Sales Person, and Month, the filter context works on
subsets of data to return Sales by a specific Sales Person and Year. You can apply filter context by
using filters this way in your reports, or by using DAX.
The following measure demonstrates how row context and filter context operate on the calculation in the
formula. A new measure is created and named UK Sales. The CALCULATE function evaluates the
expression in brackets, in a context set by the filters. The first argument in the expression is the measure
[Total Sales], which has the formula, Total Sales = SUM(Sales[Revenue]). The comma separates the first
argument from the filter argument. In this formula, the referenced column [Country], in the Customers
table, sets the row context. Each row in the Country column specifies a country, such as France, Germany,
UK, or US. This code filters on the UK, providing the filter context.
The following code is an example of a measure with the Country column in the Customers table as the
row context, and the UK value as the filter context:
This formula uses Total Sales, and applies a filter of UK, so only the sum of UK sales is returned in the
result. DAX is powerful in its ability to reference a selected value from a related table.
Demonstration Steps
1. In Power BI Desktop, in the Views list on the left side of the window, click Report.
4. In the formula bar, highlight Measure =, type the following script, and then press Enter:
TotalSales = SUM(FactInternetSales[SalesAmount])
6. Click New Column, and in the formula bar, highlight Column =, and type:
7. Point out that the TotalSales measure has been used in the formula, and then press Enter.
8. In the Fields pane, select the European Sales check box to add it to the report.
9. In the Visualizations pane, click Gauge, and then click Format.
10. Expand Gauge axis, in the Max field, type 1000000, and in the Target field, type 1000000.
You want to concatenate and manipulate columns containing string data. Which of
the following functions will not be compatible for working with text?
CONCATENATE
MEDIAN
REPLACE
TRIM
UPPER
MCT USE ONLY. STUDENT USE PROHIBITED
5-16 Modeling Data
Lesson 3
Calculations and Measures
In this lesson, you will see how to manipulate your data using calculated columns and calculated tables,
and learn how measures provide additional insights into your data.
Lesson Objectives
Add the end of this lesson, you will be able to:
Calculated Columns
Calculated columns are added to your tables by
applying DAX formulas to your existing data. The
DAX formula defines the values in the new column,
rather than querying the data source to create the
column. Calculated columns are useful when the
data source does not contain data presented in a
format that you want. You can concatenate strings
or multiple numbers together, combining data from
anywhere in the model, to create a calculated
column.
In Power BI Desktop, you use the New Column feature on the Modeling tab to create a calculated
column, or right-click the table name in the Fields pane and select New column. This opens the formula
bar where you can type your DAX formula, and press Enter to create it. By default, Power BI names the
new column as Column, but you can change this by typing in a new name. The following example creates
a new column called Full Name, concatenating existing fields together.
The following code example concatenates the First Name and Last Name fields into a new calculated
column called Full Name:
The above code does not include the table names, so these are classed as nonqualified column names.
The columns exist within the Customers table, so they do not have to be qualified. In a small dataset, with
no possibility of duplicate names in other tables, this is less of an issue, but it is considered good practice
to include the table name for clarity. If you referred to a column in another table, then you must fully
qualify the column. The following example uses the RELATED function to look up a value in another table.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 5-17
The following code example returns the related Region value for the City column in the Customers table:
After creating a calculated column, it appears in the Fields pane and behaves in the same way as other
columns. However, you can identify calculated columns by the icon next to the name. Calculated columns
can have any name you want, and can be added to visualizations in exactly the same way as other
columns.
Calculated Tables
Like calculated columns, calculated tables are
created using data that already exists in the
model—you use a DAX formula to define the values
in the table. Tables are created in both the Report
view, and the Data view in Power BI Desktop.
Calculated tables work well for intermediate
calculations, and data that you want to be stored in
the model, rather than calculated when the data
source is queried.
The following code combines the existing NorthAmericanSales and EuropeanSales tables into one, to
create a calculated table named Global Sales:
When using the UNION function to combine two tables into one new calculated table, the tables must
have the same number of columns. The columns are combined on their position in the table, so make
sure the column order matches between the two tables. UNION includes duplicate rows that exist in both
tables. If you want to remove duplicate rows, open Query Editor, and from the Reduce Rows group on the
Home tab, click Remove Duplicates. The new table has the same column names as the first table, so in
the preceding example, the UNION would take the names of the columns in the NorthAmericanSales
table. The order of the columns is also taken from the first table, and related tables are not included in the
union.
While UNION appends rows from one table to another, you can merge columns using one of the join
functions. You can use NATURALINNERJOIN, or NATURALLEFTOUTERJOIN, to merge the columns of two
tables that have a related column. The following example joins the Customers table to the Sales table on
the CustomerID column, which is included in both tables. The columns from the Sales table are added to
the right of the Customers table columns, to create the Customer Sales table.
MCT USE ONLY. STUDENT USE PROHIBITED
5-18 Modeling Data
The DAX function uses the NATURALINNERJOIN function to create a new table called Customer Sales,
which adds the columns from the Sales table to the columns from the Customers table:
In the preceding example, only rows with matching values in both tables will be added to the new
calculated table. To include all rows in the Customers table, regardless of a match in the Sales table, use
NATURALLEFTOUTERJOIN instead. When using a join, the columns you are joining on must have the same
data type.
You can use the DATATABLE function in your DAX formula to create a new table, set the data types of the
columns, and insert data. It is best to create your calculated tables in the Data view as you can view the
new table immediately. From the Modeling tab, click New Table in the Calculations group. In the
formula bar, type your DAX formula using DATATABLE to define the columns, types, and values. The
following code creates a Countries table, and adds values to the table.
The following code example creates a new table using the DATATABLE function. Use it to define the
column names and data types, and enter values into the table:
After you create a calculated table, you can use it in exactly the same way as any other table that exists in
the model, including using it in relationships. You can give the table and column names any name you
like, and format them as you would with a standard table. You then use the columns in your visualizations
alongside columns from other tables. You can also add calculated columns and measures to visualizations.
Measures
Power BI measures help you discover insights in
your data that might otherwise be hidden. You use
measures to answer questions about your data.
Some common examples would be using
aggregations such as average, minimum, maximum,
count distinct, or more complex calculations using a
DAX function. The values in your measures will
update and change alongside a data refresh, so
your reports always display up-to-date figures.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 5-19
Measures are created using DAX formulas, and with an extensive library of functions, operators, and
constructs, there is much scope to create all the measures you require. Measures are useful for creating
running totals, or comparing sales for a partial year to sales over the same time the previous year. You can
also predict sales by multiplying current year sales against a target percentage for growth, resulting in an
expected sales target.
In Power BI Desktop, you create measures in Report view, or Data view, and they appear in the Fields
pane. To create a new measure in Report view or Data view, right-click the table in the Fields pane, and
select New Measure. Alternatively, from the Modeling tab, select New Measure from the Calculations
group. It is generally easier to work in the Data view, as you can see the values of the data in the table to
which you want to add the measure. The following example creates a measure named YTD Sales. Using
the TOTALYTD function, the SalesAmount column in the FactInternetSales table is aggregated using SUM,
and the dates for the current year.
The following code creates a measure called YTD Sales. It uses the TOTALYTD function to calculate the
year to date sales:
After creating measures, you can add them to visualizations in your report, as you would any other
column. If you have a visualization showing Last Year’s Sales, you could create a new measure to calculate
sales for the coming year, based on a predicted growth percentage. The following example creates a
measure that multiplies sales for last year by 1.05, or 5 percent:
The following code creates a measure to predict sales for last year based on a 5 percent increase on the
last year:
You can change the table in which the measure resides. In the Fields pane, click the measure you want to
move, and highlight it. From the Modeling tab, select Home Table from the Properties group, and
select the table.
Demonstration Steps
1. In Power BI Desktop, in the view pane, click Data to open the data view.
2. In the Fields pane, click DimCustomer to select the table, and preview the data.
5. Press Enter.
6. If the new column is not visible, scroll to the right of the table. Note the new FullName column in the
table. In the Fields pane, point out the icon next to the new column, which indicates that this has
been created using a DAX formula.
9. Press Enter.
11. On the Modeling ribbon, in the Calculations group, click New Column.
15. On the Modeling ribbon, in the Calculations group, click New Table.
DimCountry = DATATABLE (
"Country", STRING, "Code", STRING,
{
{"United States", "US"},
{"United Kingdom", "UK"},
{"France", "FR"},
{"Germany", "DE"},
{"Spain", "ES"}
}
)
19. On the Modeling ribbon, in the Calculations group, click New Measure.
MostRecentOrder = MAX(FactInternetSales[OrderDateKey])
22. In the Fields pane, note the icon next to the measure, to indicate that this is a calculated field.
23. In the Fields pane, click the MostRecentOrder field.
24. On the Modeling ribbon, in the Properties group, click Home Table: DimCountry, and click
FactInternetSales. This moves the measure so that it resides in the FactInternetSales table.
25. In the Fields pane, note that the MostRecentOrder measure now appears under FactInternetSales.
Which of the following DAX functions is not suitable for creating a calculated table?
UNION
SUM
CROSSJOIN
NATURALINNERJOIN
NATURALLEFTOUTERJOIN
MCT USE ONLY. STUDENT USE PROHIBITED
5-22 Modeling Data
Objectives
After completing this lab, you will be able to:
View the relationships that have been created automatically in your data.
Password: Pa$$w0rd
2. Automatic Relationships
3. Manual Relationships
5. Create a new relationship between the FactInternetSales table OrderDateKey column, and the
DateKey column in DimDate. Set the cardinality to Many to One (*:1), the cross filter direction to
Single, and make this relationship active.
6. Create a new relationship between the FactInternetSales table DueDateKey column, and the
DateKey column in DimDate. Set the cardinality to Many to One (*:1), and the cross filter direction
to Single.
7. In the Relationships view, drag the ShipDateKey column in the FactInternetSales table to the
DateKey column of the DimDate column to create a new relationship.
8. Use Manage Relationships to change the cross filter direction of the relationship between
FactInternetSales and DimCurrency to Single.
9. Use Manage Relationships to change the cross filter direction of the relationship between
FactInternetSales and DimProduct to Single.
10. Use Manage Relationships to change the cross filter direction of the relationship between
FactInternetSales and DimPromotion to Single.
11. Use Manage Relationships to change the cross filter direction of the relationship between
FactInternetSales and DimSalesTerritory to Single.
12. Change the relationship between FactInternetSales and DimCustomer so this is Many to One (*:1)
from FactInternetSales. Set the Cross filter direction to Both.
13. Save the file to the D:\Labfiles\Lab05\Starter folder and name it Adventure Works Sales.pbix.
Results: At the end of this exercise, you will have a dataset combining data from two Excel worksheets,
with relationships between the tables.
Exercise 2: Calculations
Scenario
You have created the required relationships in your dataset, but feel that you could benefit from some
additional data that doesn’t currently exist. You will add calculated columns to the tables in your dataset,
to fill in the gaps.
2. Add a calculated column named IncomeStatus to the DimCustomer table, based on the
YearlyIncome column. Put the income into income brackets.
3. Add a calculated column named DaysSinceFirstPurchase to the DimCustomer table, to show the
number of days since the customer made their first purchase.
4. Add a calculated column to DimCustomer, which concatenates the FirstName and LastName
columns into a column named FullName.
5. Add a calculated column to DimCustomer, called MaleFemale, which converts the value of the
Gender column to Male, or Female.
6. Add a calculated column to DimCustomer, called Relationship, which converts the value of the
MaritalStatus column to Married, or Single.
7. Add a calculated column called MainCategory to the DimProductSubcategory table, which uses
the RELATED function to return the name of the category from DimProductCategory.
8. Add a calculated column called PromotionLengthDays to the DimPromotion table to show how
many days the promotion lasted. This is the difference between StartDate and EndDate.
9. Add a calculated column called Profit to FactInternetSales. Show the difference between UnitPrice
and ProductStandardCost, formatted as currency.
Results: At the end of this lesson, you will have calculated columns added to the tables in your dataset.
Question: Discuss the functions covered in this topic, or use the link provided in the
functions lesson of the Dax Queries topic to look online at the DAX Function Reference. How
many of these have you already used? Have you used the equivalent functions in Excel?
Which functions can you use for creating columns and measures in your organizational
datasets?
Question: Look at the dataset you used in the labs. How else can you use DAX formulas to
add additional columns or create new measures? Do you think there are any gaps in the data
that you could fill using DAX?
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 5-25
Module 6
Interactive Data Visualizations
Contents:
Module Overview 6-1
Module Overview
Self-service business intelligence (BI) is becoming increasingly popular in organizations. This approach
enables business users to access corporate data, and create and share reports and key performance
indicators (KPIs) without dependency on a dedicated report developer. Business users can use the
Microsoft Power BI suite of tools to connect to a wide variety of data sources. These include the main
industry-standard databases, Microsoft cloud-based services—Microsoft Azure SQL Database, Azure Data
Lake, and Azure Machine Learning—alongside Microsoft Excel® and other files, and software as a service
(SaaS) providers such as Microsoft Bing®, Facebook, and MailChimp. The combination of flexibility and
the ability to create visually stunning, interactive dashboards quickly makes Power BI an obvious choice
for any organization that needs to provide its users with a self-service BI solution.
Objectives
After completing this module, you will be able to:
Lesson 1
Creating Power BI Reports
This lesson concentrates on the visual report items that you add to Power BI charts. You will learn about
the different types of charts, including custom visualizations.
Lesson Objectives
After completing this lesson, you will be able to:
Work with multiple visualizations on a report, and change default categorization and summarization.
Work with geographic data and present it by using map visuals in a report.
Page Name
Under the Page Information section, you can
change the title of your report from the default
naming convention of Page 1, Page 2, Page 3, and
so on, automatically applied by Power BI. This is
particularly useful if your report comprises multiple pages, because you can guide users through your
report pages using applicable names. Type a new name into the Name box, and the name of the page is
reflected immediately on the tab at the bottom of the Power BI Desktop screen.
Page Size
By default, each new page you add to a report is created with an aspect ratio of 16:9, which is the most
suitable for modern monitors and laptop screens. You can change this to 4:3, which creates a more square
report size. If you already have visuals on your page, and change the aspect ratio, you might need to
relocate or resize any that fall off the report canvas, or overlap. Other sizing options include Cortana,
Letter, and Custom. If you select the Cortana layout, this might not appear useful for your current screen
resolution because the page becomes tall and thin. However, you can use Power BI to produce a set of
results displayed in Cortana when you ask a question of Cortana. The report can be formatted in a highly
specified layout—for example, you could create a summary page and another page showing more detail.
You can use the Letter page size to add reports to Office documents without losing the aspect. The
Custom page size option is useful if you want to pin visuals in dashboards in the Power BI service, or
embed visuals within custom web pages or applications. You can specify the exact width and height of the
page in pixels.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 6-3
Page Background
Each report background can be altered using colors and transparency. You can select from the default
theme colors that match the default colors in visuals, or you can specify a custom color. The color can
then be altered using the transparency setting to lighten or darken the tone. You can also use an image
for the background. The image displays increased transparency so that visuals remain readable, and it is
an effective way of creating highly customized reports.
Page View
You can change the zoom used to display the page by selecting Page View from the View group on the
Home ribbon. By default, this is set to Fit to Page. You can select Actual Size, which zooms into the
report so you see visuals in a closer view, with one-to-one pixel mapping. Scroll bars appear so you can
bring any hidden areas into sight. Select Fit to Width to make the page fit within the width of the screen.
Visual Relationships
When you click a data point in one of the multiple
visuals on your report, the other visuals respond by
highlighting the corresponding data. For example, if
you have a column chart showing sales by country,
and a donut chart showing sales by product color,
when you click the data point for Germany in the column chart, the following happens as a result: the
column for Germany remains the same color, but the other country columns display with increased
transparency. Furthermore, the corresponding data in the donut chart, represented as a ring, remains in
high color for Germany, while the data representing all other countries shows increased transparency—
you can now see related sales. However, if you want to click the column chart and show data in the ring
chart for Germany only, you can achieve this by editing how the visuals interact:
1. Click the visual for which you want to edit the interactive properties.
3. The other visuals on the page now show Filter and None icons. Some visuals, such as donut and
column charts, will display a Highlight icon, depicted as a chart. Click an icon to choose how each
visual responds when you click a data point in the highlighted visual:
a. Filter: this displays only the data for the selected data point. Returning to the previous example,
if the column chart displaying sales by country is selected, selecting the Highlight icon on the
donut chart would display data only for the selected country.
c. Highlight: this is the default behavior, whereby the corresponding data remains in full color, and
the remaining data is displayed with increased transparency.
You can set how each visual, including slicers, interacts when a data point is selected on another visual,
giving you complete control. When you have a group of visuals with the same behavior, you can use
shapes, such as the rectangle, or lines, to show visually that they relate and operate together.
MCT USE ONLY. STUDENT USE PROHIBITED
6-4 Interactive Data Visualizations
1. In the Fields pane, click the column in the Fields list that you want to change. The column will be
highlighted with a yellow border.
2. In the Properties group on the Modeling tab, click Default Summarization: Sum to show the full
list of options. Choose from Do Not Summarize, Sum, Minimum, Maximum, Average, Count, or
Count (Distinct).
3. When a new visual is created using that field, the aggregator value is now changed. However, if you
have an existing visual that uses the column for which you have changed the default summarization,
this is not updated. In this case, right-click the column in the Values bucket, or select the down arrow,
and chose another summarization option. This menu includes Standard deviation, Variance, and
Median.
You can use the Formatting group on the Modeling ribbon to add symbols to your data—which is
particularly useful for indicating what the data represents. Choose from numerous currency symbols,
apply a percentage format, and manage how you present numbers with commas to separate thousands.
The default categorizations of a field can also be customized. For example, when working with geographic
data, if you have locations that could be considered either a country or a state, such as Georgia, or a city
or a state, such as Washington, you can add a categorization so that map visuals plot the data with
accuracy. To change the categorization, use the following steps:
1. In the Fields pane, click the column in the Fields list that you want to change. The column will be
highlighted with a yellow border.
2. In the Properties group on the Modeling tab, click Data Category: Uncategorized. Select one of
the following options: Uncategorized, Address, City, Continent, Country/Region, County,
Latitude, Longitude, Place, Postal Code, State or Province, Web URL, Image URL, or Barcode.
Creating Charts
By using the chart visuals in Power BI Desktop, you
can quickly create visually stunning interactive
reports and dashboards.
Chart Types
Power BI includes bar, column, area, line, pie, and
scatter charts, along with maps, slicers, gauges, KPIs,
R, and table visuals. You can select a chart from the
Visualizations pane to add to the report canvas, or
you can drag a data field onto the report to create
a table visual automatically—this can then be
converted to another chart type. For example, you
can drag a Categories field onto the report, which
creates a table. You can then drag TotalSales onto the table, to add another column. You can then click
one of the chart icons in the Visualizations pane, and quickly switch between bar or pie charts. After
adding charts to your report, you can optionally set the page filter property so that users can drill down,
and chart items simultaneously reflect the page filter.
Clustered bar and column charts are like stacked charts, but they include two data fields for the Value,
which results in two bars or columns for each axis. To build on the previous example, you could add Sales
Quota to the Value, to compare the amount of sales so far, with the target quota set for each salesperson.
Bar and column charts that are 100 percent stacked are like stacked and clustered charts, except that the
bars and columns stretch the width or length of the chart area, and display the progress of each axis
against a value. You add two data fields to the Value, such as Sales YTD and Sales Quota. Charts that are
100 percent stacked are useful for displaying progress in meeting a target figure. In this example, the
Sales YTD figure can combine with the Sales Quota figure to show how far each salesperson is
progressing toward meeting their annual target.
The bubble chart is based on the scatter chart and works with three numeric values. The bubbles are sized
to represent the data proportionally. A bubble chart is created by using a scatter chart, and then adding a
data field to the Size property.
Note: All the chart types listed previously enable you to add one or more reference lines. In
the report view, click Format, and then toggle Reference Line to On. In the Value field, type a
numeric value such as 100,000. You can change the color and transparency, and choose a style
from dotted, solid, or dashed. You use the Arrange property to decide whether you want the line
behind or in front of the other elements on the chart.
Toggle Data label to On or Off to show or hide the number in the Value field. Power BI
automatically displays the currency of the data, so if you add a reference line to a chart
measuring sales, the reference line value appears as $100,000, for example. You can change the
color of the data label, and choose the horizontal position, to display the label on the left or
right, and above or below the line.
The scatter chart, which includes the bubble chart, enables you to set a reference line for the x-
axis and y-axis. All formatting features are available, so you can fully customize both lines.
Tree Map
The tree map might not physically represent a tree, but the principle behind its function is representative
of a tree. On a tree map, larger data scales through to smaller data, as if the data were branches scaling
down to twigs. The largest data value, represented as a rectangle, is in the lower-left corner, with the
smallest in the upper-right corner. For example, add the City data field to Group, and Total Sales to
Values. Each city is represented by a rectangle that is proportionate to the number of sales, so the cities
that have the most sales have the largest rectangles.
R Visual
Power BI Desktop supports statistical analysis through integration with R, and the hosting of R
visualizations. When you select the R visual from the Visualizations pane, a placeholder is added to the
page. You are then presented with an R script editor that you can use on the canvas, and when you add
fields to the R visual, they are automatically added to the R script editor pane. After you have created your
script in the editor, click Run. The data added from the Fields pane is posted to the local installation of R.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 6-7
The script created in the R editor is then run on the local R installation. The R installation returns a visual
to Power BI, which then displays on the canvas in the R visual.
Other Charts
There are other types of chart in Power BI, including waterfall, funnel, gauge, card, multirow card, KPI, and
slicer. For more information about using these charts, including how-to guides and tips, see the following
article:
Visualizations in Power BI
http://aka.ms/Cfrub0
Formatting Charts
Each chart includes options for formatting. The available options depend on the type of chart. If you use a
data field—for example, Salesperson—in a column chart and a pie chart, the colors for each person are
identical in the two charts. This retains consistency within the report, although you have the option to
change the color for each data field. It also means that, when you click a Salesperson, all charts reflecting
their data show as the same color. Use formatting to add data labels, change colors, and add titles,
backgrounds, borders, and more.
When you add data to a visual, Power BI sorts values alphabetically. If you want to sort your data by
another value, you can change the sort order by using the data model. The funnel chart is one example
where you are likely to want to sort by a numeric value, rather than a string value; otherwise, the bars that
form the funnel do not align to a funnel shape. To sort the data, view the dataset in Data View, on the
Sort ribbon menu, select Sort By Column, and then choose the column from the list.
Data Categorization
When you import data, Power BI makes assumptions about that data based on the table and column
names. Power BI assumes that you want to aggregate numeric columns—and always places them in the
Values area when you drag them onto a chart. If you had a column named Location Code, with a value of
“CA,” this could refer to the state of California, or the country, Canada. Data categorization helps to solve
this problem and can be applied in both the report view and the data view. In the Fields list, select the
field that you want to categorize, and then on the Modeling ribbon, on the Properties menu, select Data
Category. You can choose from Address, City, Continent, Country/Region, County, Latitude,
Longitude, Place, Postal Code, State, or Province. If a category is not appropriate for a data type, it is
disabled in the list.
FullAddress = [AddressLine1] & " " & [AddressLine2] & " " & [City] & " " & [PostalCode]
The concatenation only works with string data types, so you might need to convert numeric values to
string as part of your formula. You can then use this FullAddress field in your map chart.
Note: If you drag a data field such as City or Country onto the report, Power BI detects
that it is geographic data and automatically adds a map chart.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 6-9
Histograms
Histograms might initially look very similar to bar
charts, but there are two fundamental differences:
Each bar in a histogram chart is also proportionally representative in size. Using the previous
example, the 0-17 years bar is wider than the 18-24 years bar because it represents a range of 18
years inclusive, compared with the seven years (inclusive) of 18-24. Again, this requires a contiguous
range of values in the buckets.
Power BI does not include a histogram chart by default; however, you can download a custom visual from
the community gallery. To do this:
1. Visit the Power BI community gallery, and then click Histogram.
2. Check that this is the visual that Microsoft has developed, and then in the Description dialog box,
click Download Visual.
3. Read the terms and, if you agree with them, click I agree in the Licensing dialog box. The visual is
saved to the default download folder that is specified in your browser's settings.
7. Browse to the download folder, click the visualization (histogram.pbiviz) file, and then click Open.
8. When the Success confirmation dialog box appears, click OK. The histogram icon now appears in
the Visualizations pane and is ready to use.
Click the histogram icon, and the visual appears on your report as a watermark template. To use the
histogram, provide a field for the Values (x-axis), and the field for aggregating in the Frequency (y-axis).
The histogram automatically works out the bins, also known as buckets, and you can set the number of
bins in the properties pane.
Alternatively, you can download other custom histogram visuals from the Power BI community gallery.
Custom visuals are discussed in the next topic.
Demonstration Steps
1. If you do not have a Power BI login, open Internet Explorer, go to
https://powerbi.microsoft.com/en-us/documentation/powerbi-admin-signing-up-for-power-
bi-with-a-new-office-365-trial, and follow the steps to create an account.
3. On the Choose the download you want page, select the PBIDesktop_x64.msi check box, and then
click Next.
5. In the Microsoft Power BI Desktop (x64) Setup dialog box, on the Welcome to the Microsoft
Power BI Desktop (x64) Setup Wizard page, click Next.
6. On the Microsoft Software License Terms page, select the I accept the terms in the License
Agreement check box, and then click Next.
10. On the Completed the Microsoft Power BI Desktop (x64) Setup Wizard page, clear the Launch
Microsoft Power BI Desktop check box, and then click Finish.
1. Ensure that the MSL-TMG1, 20778A-MIA-DC, and 20778A-MIA-SQL virtual machines are running,
and then log on to 20778A-MIA-SQL as ADVENTUREWORKS\Student with the password
Pa$$w0rd.
2. In the D:\Demofiles\Mod06 folder, run Setup.cmd as Administrator, and then click Yes when
prompted. If asked Do you want to continue with this operation?, type Y and press Enter.
3. When the script completes, press any key to close the window.
4. Start Microsoft SQL Server Management Studio from the taskbar, and then connect to the MIA-SQL
database engine instance by using Windows® authentication.
9. In the Get Data dialog box, click Microsoft Azure SQL Database, and then click Connect.
10. In the SQL Server database window, in the Server box, type the URL of the Azure server <Server
Name>.database.windows.net (where <Server Name> is the name of the server that you created).
11. In the Database box, type AdventureWorksLT.
13. In SQL Server Management Studio, copy the query under Customer Address in the 1 - Charts.sql
query.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 6-11
14. In Power BI Desktop, paste the query into the SQL Statement (optional, requires database) box,
and then click OK.
15. In the SQL Server database window, click Database, in the Username box, type Student, and in the
Password box, type Pa$$w0rd, and then click Connect.
17. The window will close and a blank report canvas will open.
19. In the Get Data dialog box, click Microsoft Azure SQL Database, and then click Connect.
20. In the SQL Server database window, in the Server box, type the URL of the Azure server <Server
Name>.database.windows.net (where <Server Name> is the name of the server that you created).
23. In SQL Server Management Studio, copy the query under Sales in the 1 - Charts.sql query.
24. In Power BI Desktop, paste the query into the SQL Statement (optional, requires database) box,
and then click OK.
1. In the Fields pane, right-click Query1, click Rename, type Customers, and then press Enter.
2. Right-click Query2, click Rename, type Sales, and then press Enter. Expand the two tables to display
all the fields.
3. In the Fields pane, under Sales, select the SubCategory, and OrderQty check boxes. Power BI
creates a table.
4. In the Visualizations pane, click Stacked column chart.
5. Grab the expander on the right edge of the chart, and then widen the chart so that all category labels
are visible.
6. Ensure that the chart is still selected, and then in the Visualizations pane, click Analytics.
16. On the Modeling ribbon, click Format: General, point to Currency, and then click $ English
(United States).
18. In the Fields pane, under Sales, select the Product check box, which adds a table, and then select the
LineTotal check box.
19. In the Visualizations pane, click Fields, under Filters, expand LineTotal(All).
20. In the list, click is greater than, and in the box, type 25000.
21. Click Apply filter, and then note that the number of products in the table is reduced.
22. In the Visualizations pane, click Format, click Title, and change the Title slider to On.
23. Under Title, in the Title Text box, type Product Sales Over $25k, and then click Center.
24. Select the table, and then click Stacked bar chart.
25. Use the expander to widen the chart to the same width as the column chart.
26. On the chart, click More Options, and then click Sort By LineTotal.
27. At the bottom of the window, click the + icon to add a new report.
28. On the Home ribbon, click Manage Relationships, and then point out that Power BI has auto-
detected the relationship on the CustomerID columns, then click Close.
29. In the Fields pane, expand Customers, and then select the City check box. Power BI automatically
adds a map chart. Expand the map to show all countries.
30. In the Fields pane, under Sales, select the LineTotal check box to add it to the map. Grab the right
corner of the map, and then drag it to fill the whole of the report page.
31. Zoom in on the map to focus on the UK. Point out that the bubbles now represent the sales for each
customer, and are proportionately sized. Position the cursor over some of the bubbles to display the
data labels.
32. Save the file as Customer Sales, in the D:\Demofiles\Mod06\Demo folder.
Question: Discuss some of the charts that you could use to represent your organizational
data. What types of chart would you use? Would different charts represent the data in
different ways? Do you have data that would benefit from using a scatter chart, so that you
can identify clusters, or outliers? Are there any missing chart types in Power BI that you
might be able to download from the community gallery to fulfill your requirements?
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 6-13
Lesson 2
Managing a Power BI Solution
This lesson discusses the management aspect of Power BI. It examines how to use the Manage Data
portal, what data is included in the Usage Report to show user activity within your Power BI tenant, and
how to manage shared queries and data sources.
Lesson Objectives
After completing this lesson, you will be able to:
The Manage Data portal that is delivered through Power BI for Microsoft Office 365™ offers a cloud-
based solution to these problems by helping to:
Enable users to request access to data sources that they require for their analysis and reporting.
Reduce the dependency on IT to develop reports that can take months to deliver.
MCT USE ONLY. STUDENT USE PROHIBITED
6-14 Interactive Data Visualizations
Business users can find and share queries that are derived from a wide range of data sources by using the
searching and sharing features in the Get & Transform functionality of Excel 2016. Business users can then
manage these by using the following tasks in the Manage Data portal:
Self-service information management (SSIM) enhances the experience of self-service BI, empowering users
to manage their data without depending on IT.
Usage Analytics
Usage analytics provide administrators with detailed
information regarding how Power BI users within
the tenant are querying and accessing the data,
reports, and dashboards. These analytics can help to
identify the most active users, and the most
frequently consumed dashboards and datasets, in
addition to unused data and reports.
The first section displays usage analytics for individual users, with a count of user dashboards, reports,
and datasets within the tenant. Further to this is a bar chart that displays Most Consumed
Dashboards by Users, and a tree map that shows Most Consumed Packages by Users. The term
“packages” refers to content packs that have been created within the organization, and from SaaS
providers such as Bing, Salesforce, and Facebook. The Top Users with Most Dashboards and Top
Users with Most Reports tables show how many reports and dashboards individual users can access.
This can be indicative of users who are most active within Power BI.
The second section offers the same usage information, but it is presented for groups. You can see
which groups are most active, in addition to the data that they are accessing. At the top of the section
are counts for the number of group dashboards, reports, and datasets. As in the previous section, a
bar chart displays the Most Consumed Dashboards by Groups, and a tree map shows Most
Consumed Packages by Groups. Furthermore, there is a table each for Top Groups with Most
Dashboards and Top Groups with Most Reports.
You use this information to see how users access data and dashboards—it highlights those users and
groups that are most active. Conversely, you can use this information to find out why other users are not
very active in Power BI, and investigate why particular dashboards are not being used. There might be an
underlying problem with the data: for example, perhaps the correct data has not been made available, or
it does not cover a required period.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 6-15
Shared Queries
In Excel 2016, queries can be shared by business
users or data stewards who are using Power BI for
Office 365. After queries have been shared, they are
available to users who have sufficient permissions.
Using the online search option on the Get &
Transform menu in Excel, users can search for and
reuse shared queries in their data analysis and
reports. Users can view their shared queries in the
Manage Data portal. Log on to the portal, and then
click my queries in the left pane. You are presented
with a list of queries that are sorted in alphabetical
order by the name and description that you gave
them in Get & Transform. The portal provides several features for managing your shared queries by
clicking the open menu ellipsis next to the query, or by right-clicking.
Analytics
Click ANALYTICS to view the usage of a shared query by using different views:
Queries shown in search over time. See how many times the query was searched over a selected
period. The analytics display how often the query appeared in a search result, so if the count is very
low, users may not be finding it easily when searching. In this case, you can alter the metadata to
make it more discoverable.
Clicks from search. Find out how many times the shared query was imported into Excel by users over
a selected period. See the Top Query Users who imported the query, and the number of times the
user clicked the shared query. Use this information to find out whether there are issues with a query,
such as the data not meeting requirements and therefore not being clicked and imported. The
Microsoft Lync® information for each user appears in the analysis display area, and includes online
presence, location, status, and contact details. You can contact users if you want to follow up on their
usage.
Filters. Use the filters to select the shared query that you want to analyze, and then set the timeframe
from last day, or last 30 days. You can compare multiple shared queries under the Queries section
to the compare usage statistics. After logging on to the Manage Data portal, you automatically see
the analytics for all your shared queries.
Manage
You can edit your query by using the MANAGE option in the Manage Data portal. You can also change
the name of the query and add or update the description, and the documentation URL.
Share
Use the SHARE option to view the users who already share the query, and send an invitation to other
users. Click Invite people, and then type the users’ email addresses, or type “everyone” for sharing the
query with all users within your organization. Click Share, and users are invited to share your query.
Delete
Click DELETE if you no longer need the query. Confirm that you want to delete the query by clicking
Delete in the Confirmation dialog box.
MCT USE ONLY. STUDENT USE PROHIBITED
6-16 Interactive Data Visualizations
Data Sources
In the Manage Data portal in Power BI for Office
365, there is a cloud-based repository called the
Data Catalog. When you share a query, the
metadata for the data source connection is held in
this storage area, meaning you can manage your
data sources from a single location. The Data
Catalog enables users in your organization to
quickly find and request access to data sources.
Users then feel reassured that they are using secure
data sources.
2. In the left pane, click data sources to display a list of all your data sources. You can view, sort, and
filter the list of data sources. The list includes information about each of the data sources, including
Name, Status, Location, Description, Modified Date, and Modified By. The Status column in the
data source includes a color icon so that you can quickly see an overview of all sources. A green icon
indicates that the data source is Complete, yellow is Incomplete, and red highlights that the data
source is Missing. The Modified By column derives information from Lync, so if the user who last
modified the data source is present, this is indicated by a colored icon.
3. In the list, select the data source that you want to edit, and then right-click the list item, or click open
menu located next to the data source name. In the dialog window, click EDIT.
4. In the next screen, you can edit the name of the data source, and the description that users see when
they search for the data source in the Power BI Data Catalog. Try to be specific and informative in
naming and describing data sources.
5. In the Approver for access requests field, you can enter an email address or URL:
o Email address. Type the email address of the person who will respond to requests for access.
When a user requests access to the data source, a precomposed email message opens on his or
her local computer by using their default mail client. The user can optionally include details of
why they need access, and then send the email message.
o URL. Enter a URL string. When the user requests access, the URL opens in the user’s default
browser.
Note: The Power BI Data Catalog enables you to view and manage data sources. You
cannot delete a data source from here because of the implications elsewhere.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 6-17
General
Preview features: Some of the new
functionality is released as preview features, so
you can toggle the setting to select whether you have early access to new features and experiences in
Power BI. If you frequently collaborate with other colleagues, you might want to decide whether you
all have access to preview feature; otherwise, you might find yourself using a new feature that others
can’t access.
Privacy: Microsoft automatically collects the search terms you use in Power BI, as part of their
commitment to ongoing product improvement. If you do not wish to participate, clear the check box
to stop sharing your search terms.
Language: you can choose which language appears in the Power BI user interface and parts of the
visuals. Select your relevant language from the list and click Apply. This resets the interface to show
the chosen language, including menus, buttons, and messages. Certain features might only be
available in English as the service undergoes continuous improvement and development.
Close account: closing your account deletes any content you have created, and you no longer have
access to the Power BI service. To close your account, optionally select the reason for closing from the
list, and add any further information for Microsoft that you would like them to know about your
reasons for closing the account. Click Close account.
Developer: this setting enables developers to include visuals for testing. Turn this setting on if you
want to create custom visuals for Power BI.
ArcGIS Maps for Power BI: Power BI has integrated ArcGIS maps from ESRI. Using the ArcGIS visual,
you can create sophisticated maps and discover insights in your data that might otherwise be hidden
in the standard mapping visuals—for example, by using the heat map feature.
Dashboards
You can change settings on an individual dashboard level, enabling you to control the behavior of
dashboards more specifically. Under the Dashboards tab, you will find a list of all your dashboards. Click a
dashboard to change the following settings:
Q&A: you can toggle this setting to show or hide the Q&A search box on each dashboard. The search
box is enabled by default.
Dashboard tile flow: this setting ensures the dashboard content is automatically aligned to the
canvas. If the setting is on, when you move a tile on the dashboard, the layout is adjusted
automatically so the tile fits. This feature is turned off by default.
MCT USE ONLY. STUDENT USE PROHIBITED
6-18 Interactive Data Visualizations
Datasets
Datasets are managed at the report level. Under the Datasets tab, you will see a list of all the reports you
have published to Power BI, and can alter the following settings for each report:
Refresh history: click the Refresh history link to view scheduled and OneDrive data refresh history.
The Start and End dates enable you to determine the length of time taken for each data refresh. The
Status shows whether the refresh completed or failed.
Gateway connection: use this setting to view and manage your gateway connections. This displays
the status of your Power BI personal gateway—and if it is online and running. If you have other
gateways connections, you can optionally switch using the toggle.
Data source credentials: if you have connected to a data source that includes credentials such as a
username and password, you can manage them by expanding the Data Source Credentials link.
Schedule Refresh: toggle the option Keep your data up to date to schedule the refresh of a
dataset. You can set the refresh frequency, such as Daily, and set which time zone to use.
Furthermore, you can have a notification emailed to you if the refresh fails.
Q&A and Cortana: use the Allow Cortana to access this dataset option if you want Cortana to
share the information with other Power BI users who have access to it. By default, this setting is
turned off.
Featured Q&A Questions: You can add, edit, and delete featured questions that will be displayed as
suggestions for the dataset in Q&A. This is helpful when sharing your dashboards with colleagues.
Workbooks
Workbooks are managed on an individual basis. You can rename and delete workbooks within your My
Workspace area.
Alerts
Use the Alerts tab to turn off, edit, and delete your alerts that have been added from Power BI Mobile.
You can rename alerts, and manage the conditions of the alert. Use this setting to change the frequency
of the alert—you can also toggle between At most every 24 hours, or At most once an hour. Alerts are
only sent when the data changes, and by default you receive notifications in the notification center. Select
Send me email, too to receive alerts in your inbox.
For a list of countries and languages supported by Power BI, see the following article:
Supported languages and countries/regions for Power BI
https://aka.ms/adoke1
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 6-19
Global
Data Load: this setting enables you to manage
the volume of data that is locally cached. The
default limit of cached data is 4096 MB and,
although you can adjust this level up or down, Microsoft does not recommend that you reduce it
below 32 MB. You can clear the cached data, and restore to the default setting.
Query Editor: numerous settings are available for the Query Editor. You can toggle to show or hide
the Query Settings pane, and show or hide the formula bar. These are shown by default. To preview
data, you can choose to display the data using a monospaced font, and choose whether to show
whitespace and new line characters. You can also turn on the setting to allow parameters in data
sources, and transformation dialogs. This setting is turned off by default.
DirectQuery: the DirectQuery option allows unrestricted measures on DAX expressions while using
the DirectQuery mode to connect to a data source. This is turned off by default.
R Scripting: you can manage your R script settings by informing Power BI of the location of your R
home directories—and which R integrated development environment (IDE) to launch from within
Power BI. This tab includes links to articles on installing R, and learning about the R IDE.
Security: use this tab to set user approval for new native database queries. This is turned on by
default. Furthermore, you can set the web preview warning level, choosing from Strict, Moderate, or
None. The default setting is Strict, which means the user sees a preview warning before a web
preview is displayed; the Moderate option shows a warning only if the URL has not been explicitly
entered, or is a trusted site; choose None to hide all warnings. You can choose whether to show a
security warning when adding a custom visual to a report. This is on by default. You can also view
your approved ADFS authentication services, and delete unwanted entries.
Privacy: use this tab to set the isolation level of your data connections to determine how they
interact, if at all. By setting a higher privacy level, you can prevent data sources from exchanging data.
However, this can have an impact on the functionality of your reports, and have an adverse effect on
performance. You also set the privacy level at the data source and file levels, so the option you
choose at a global level is affected by these lower level settings. For the highest level of security,
choose Always combine data according to your Privacy Level settings for each source, which
uses the privacy set at the data source level, and gives you the most control. The default setting is
Combine data according to each file’s Privacy Level settings, enabling you to manage security on
a file basis. Alternatively, you can choose Always ignore Privacy Level settings, but be aware that
you could potentially expose sensitive or confidential data. The hyperlink in the tab contains detailed
information on setting privacy levels.
Updates: toggle Display update notifications for Power BI Desktop to see alerts when a new
version of the Power BI Desktop application becomes available for download. With regular monthly
updates to the application, this useful feature is turned on by default.
MCT USE ONLY. STUDENT USE PROHIBITED
6-20 Interactive Data Visualizations
Usage Data: you can choose to send usage information to Microsoft to help improve the product, by
sharing the features that you use. This does not disclose any personal information or data, and runs
silently without affecting the performance of the application.
Diagnostics: toggle Enable tracing to turn on the capture of diagnostic data. This is turned off by
default. Use this tab to view the current version number and monthly release date of your installed
application.
Preview Features: use this tab to choose which preview features you would like to try out—the list of
features changes with new releases. Each included preview feature has a link back to the Power BI site
so you can learn about the feature before deciding to preview it. Some of the preview features might
be enabled by default.
Auto Recovery: it’s worth checking the auto recovery options before you begin using Power BI
Desktop. This ensures that your work is saved as often as you need, in case of incidents that cause the
application to close unexpectedly. The Store Auto Recovery information every 10 minutes option
is selected by default. You can optionally turn this setting off, or adjust the frequency at which auto
recovery information is stored—for example, to every five minutes. You can also toggle the Keep the
last Auto Recovery version if I close without saving option. This useful feature is turned off by
default but is certainly worth enabling to prevent any accidental loss of work. You can also change
the location where Power BI auto saves your files.
Current File
Data Load: use this tab to configure how data is managed when connecting to, and importing from,
a data source. The Automatically detect column types and headers for unstructured sources
option is turned on by default, and helps you when importing loosely structured data. Power BI
makes a best guess at the type of data in each column on import—this can be altered later in the
Query Editor. You can configure several settings for the relationships within your data. You can turn
off the default option to Import relationships from data sources, in which Power BI uses the
foreign keys in the imported data to detect relationships between tables. The setting Update
relationships when refreshing queries is turned off by default. This option looks for relationship
changes that have occurred since the data was last imported; however, it can potentially remove any
relationships you might have created manually. The Autodetect new relationships after data is
loaded option is turned on by default and helps you find related data that might not have an existing
foreign key relationship. The time intelligence setting, Auto Date/Time, is also turned on by default.
This creates a hidden date table for each column in the dataset that has a date or datetime data type.
The date table holds a set of contiguous dates, from the earliest to latest dates, enabling you to
perform analysis over time. For example, you can compare sales on a date, or a date range from last
year, to sales on those dates in this year. The Allow data preview to download in the background
option is turned on by default. This is useful when connecting to a data source as you can see a
preview of the data before you select it for importing. You can turn this off if you are connecting to a
very large dataset and don’t need to see the data values before you import the data. Another setting
that is automatically turned on is Enable parallel loading of tables. This enables Power BI to
simultaneously load data from multiple sources, though be aware that it can affect performance.
Regional Settings: use this tab to set the Locale of the current file. The language setting you choose
affects how numbers, dates, and time from imported data are interpreted. For example, you can
select English from United States, United Kingdom, or Australia, or select French for France,
Luxembourg, or Monaco.
Privacy: you can edit the permissions for each connection in your files to work with or override the
settings at the global level. Choose from the default Combine data according to your Privacy Level
settings for each source (this is discussed in the section below), or Ignore the Privacy Levels and
potentially improve performance. The last setting has the potential to expose your data to
unauthorized users, so use caution if working with sensitive or confidential data.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 6-21
Auto Recovery: the Disable Auto Recovery for this file option overrides the global setting and is
turned off by default. Only turn this on if you are sure you can afford to lose work in the case of
unexpected application behavior.
As discussed above, you can configure privacy options at the file and data source level. Use Edit
Permissions to set the privacy for each data source, choosing from None, Public, Organizational, or
Private. By default, data sources are set to None, so if your data contains sensitive or confidential data,
ensure you change it to Private. The Private setting isolates the data source from other sources, and is
useful if you want to restrict access to authorized users only. Data sources that only need to be visible
within a trusted group of people can use the Organizational setting. This isolates the data source from all
Public data sources, but enables visibility to other Organizational data sources. Only data that is freely
available, such as that on a public website, or from a data marketplace, should be secured as Public,
because the source becomes visible to everyone. If your data sources use credentials, you can also
manage them on the Edit Permissions dialog.
Note: Changing options might require Power BI Desktop to be restarted before they can
take effect.
Filtering a Dashboard
When you view a dashboard in the Power BI service,
unlike reports, filters are not immediately available
to you. However, you can filter on individually
pinned tiles. If you click Focus mode in the top
right-hand corner of a tile, this opens the tile so it is
the only one in view. You can then expand the
Filters pane, to filter on categories in the chart, and set criteria on values. For example, you can filter on
products, or show data where sales are above $150 million and less than $250 million.
MCT USE ONLY. STUDENT USE PROHIBITED
6-22 Interactive Data Visualizations
Featured Questions
Q&A enables you to ask natural query language questions of your data. There are a couple of features in
your reports and dashboards that you can use to enhance the results returned to Q&A. When you click
Ask a question about your data, the Q&A box expands to include suggestions from the fields,
calculations, and measures in the data model, to help you get started. You can add suggestions to this list
to enable other users to quickly find the answers they need, using the following steps:
1. Click My Workspace. In the Dashboards list, on the dashboard you want to configure, click
Settings.
2. Under Q&A, use the toggle to enable Q&A.
3. Click Save.
4. In the top right-hand corner of the screen, click Settings, and choose Settings from the menu.
5. Click Datasets, and select the data you want to configure from the list.
7. You can delete existing questions, or click Add a question to create a new question. This opens a
new text box. Type in your question, and click Apply after adding all the questions you want to
include.
8. Click My Workspace. Select the dashboard to which you have added one or more Featured
Questions. Click Ask a question about your data, and the Featured Questions you have just added
now appear at the top of the list of suggestions. Click a question to see the results.
Further to this, you can add keywords and filtering to a report to guide users to find the exact data they
need when asking a question:
1. From My Workspace, click the report you want to alter then click Edit report.
2. Drag a column from the Fields pane to Page level filters—for example, Manufacturer.
3. Click Require single selection so the page is displayed in results in Cortana or Q&A.
4. Click Format, then click Page Information, and toggle Q&A to on. This prompts Q&A to use the
report if a user asks a question related to the data in the report.
5. In the text box, type in alternative names, or terms that users might type when asking questions, such
as manufacturer performance. Separate each phrase with a comma.
6. Click Save.
When you, or another user, search using a combination of the phrase and the filter, more accurate results
can be returned. For example, in the dashboard’s Q&A box, type in manufacturer performance and
Power BI returns a list of all the manufacturers from the filter. You can select a filter and the results are
displayed just for that manufacturer.
You can export the data for any visual within Power BI. To do this from a pinned tile on a dashboard, click
the ellipsis in the top right-hand corner of the tile, and then click Export. This begins an immediate
download of the data into a comma separated value (.csv) file. Exporting from a report gives you an extra
option. Open the relevant report, click the ellipsis, and choose Export data. You can then choose to
export Summarized data, or Underlying data. In addition, you can choose to export to Excel format
(.xlsx) or .csv. The data is exported with any filters that have been applied to generate the results in the
visual. You can now ask a question of your data, view the results, and then export them.
Publish to Web
You use the Power BI Publish to Web feature to share a report by creating a URL you can send through
email or social media, or embedded code that can be used in webpages, or blog posts. You can also edit,
update, refresh, and unshare visuals you choose to publish. The Publish to Web feature is available in
reports that you can edit in your personal or group workspace. You cannot publish reports that were
shared with you, or use row level security to secure the data. To publish a report to the web, use the
following steps:
1. From My Workspace, open the report you want to use, and select File, then Publish to Web.
2. Review the information in the displayed dialog, and click Create embed code.
3. A warning is shown asking you to confirm that the data can be made public. If you agree, click
Publish.
4. You are then shown a link to use in an email, and HTML iframe code that can be pasted directly into a
webpage or blog. Optionally, you can use the sizing list to ensure your report displays in the best
possible way to present the data. The default is 800 x 600 pixels. After copying and pasting the text,
you can change the height and width values as required.
Each report has a single embed code. Click Settings, then click Manage embed codes to see a list of
reports for which a code has been generated, and the time and date of generation. To copy the code, or
delete the code, click the ellipsis next to a report. If you delete a code, any webpages that embed the
report, will no longer be able to display it. This feature also supports custom visuals.
Note: Use the Publish to Web feature with caution, because making your data publicly
available allows anyone to view it. There is no inclusion of authentication, so always check that
the data you publish is insensitive.
This feature can be turned off by administrators who have access to the Admin Portal. Go to
Tenant Settings, and set Publish to Web to Off. The affects the current tenant.
For more detailed information, and the limitations of this feature, see the following article:
https://aka.ms/eq7ft3
Additionally, you can change the title and subtitle for the tile by overwriting the text in the Title and
Subtitle text boxes. It is also useful to show the date and time the item was last refreshed, using the check
box to enable this addition to the tile. When this is done, click Apply. You can use this feature so a
company logo directs the user to the main corporate home page, or perhaps other pages in the corporate
site that contain more detailed information relevant to the visual.
Use Featured Questions to enhance the user’s experience when using dashboards.
Demonstration Steps
Add Featured Questions to a Dashboard
1. Ensure that the MSL-TMG1, 20778A-MIA-DC, and 20778A-MIA-SQL virtual machines are running,
and then log on to 20778A-MIA-SQL as ADVENTUREWORKS\Student with the password
Pa$$w0rd.
2. In Power BI Desktop, click Publish to publish the report you created in the previous demo.
3. In the Power BI Desktop dialog box, enter the password for the account you used to sign up for the
Power BI service, and click Sign in.
5. Sign in using the credentials you used to sign up for Power BI service.
6. In Power BI, click Show the navigation pane.
8. At the bottom of the page, click Page 1, click the Orders by Sub Category visual, and then click Pin
visual.
9. In the Pin to dashboard dialog box, click New dashboard, type Customer Sales, and then click Pin.
10. Under Dashboards, click the ellipses (…) next to Customer Sales, and then click Settings.
11. On the Dashboards tab, under Q&A, ensure the Show the Q&A search box on this dashboard
check box is selected.
14. Click Add a question and in the text box, type Show sales by customer.
15. Click Add a question, and in the text box, type Show all products with unit price greater than
$250, and then click Apply.
End of List
2. Click Ask a question about your data, and the Featured Questions you have just added now appear
at the top of the list of suggestions.
4. Remove the question text, and then click the Show all products with unit price greater than $250
question to see the results.
Which of the following statements about the Manage Data portal is false?
You can edit and control access to your data sources in the portal.
Using the portal enables you to delete data sources that you no longer need.
The Usage Report shows how many times a dashboard was consumed in Power
BI.
The Usage Report displays the most active groups in Power BI.
MCT USE ONLY. STUDENT USE PROHIBITED
6-26 Interactive Data Visualizations
Objectives
After completing this lab, you will be able to:
Password: Pa$$w0rd
3. Shape Data
4. Combine Data
3. Sign up for an Office 365 login if you do not already have one.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 6-27
4. Run the query under Task 1 in the Lab Exercise 1.sql file to import the customer data.
6. Run the query under Task 2 in the Lab Exercise 1.sql file to import the sales data.
11. Add a new column called FullAddress, and then for the value of each row, concatenate
AddressLine1, City, StateProvince, CountryRegion, and PostalCode.
17. Add a new column called LineTotal, which multiplies the OrderQty column by the ListPrice column.
18. Change the format of the LineTotal column to the currency $ English (United States).
19. Create a new measure named TargetSales, which increases the LineTotal field in the Sales table by
20 percent.
20. Save the file, and then leave Power BI Desktop open for the next task.
2. In the States worksheet, select the data, and then copy it.
3. Create a new table named Sales by States by pasting in the data from the workbook.
MCT USE ONLY. STUDENT USE PROHIBITED
6-28 Interactive Data Visualizations
15. Hide the States with Codes table in the report view.
16. Save the file, and then leave Power BI Desktop open for the next exercise.
Results: After this exercise, you should have imported data from Azure, shaped it by using the Power BI
transformation tools, and combined the data by merging columns and appending rows.
3. Change the title of the gauge to Target Sales, and then center-align the text.
4. Drag the CompanyName and LineTotal fields onto the report to create a table.
5. Change the table to a pie chart, and then expand the chart to show all company names.
6. Change the title of the pie chart to Top Selling Companies, and then center-align the text.
7. Drag the MainCategory field onto the report canvas to create a table.
10. Use the OrderQty field values for the Color saturation property of the chart.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 6-29
11. Click Analytics, expand Constant Line, and click Add. Set Value to 500, and then change Color to
red.
12. Toggle the data label for Constant Line, and then set Color to red.
13. Change the title of the chart to Orders by Main Category, and then center-align the text.
16. Change the title to Sales by Main Category, and center-align the text.
17. Create a table by dragging the Product field onto the report canvas.
20. Filter the products to display only those that have sales greater than $32,000.
21. Filter the list to display only bikes.
23. Change the title to Top 10 Selling Bikes, and center-align the text.
24. Add a Constant Line, with the Value set to 35000, and then set Color to red.
25. Expand the chart to fill the remaining space on the report. If necessary, move your visuals around to
make them fit.
26. Save the report.
2. Create a map by adding the City field from the Customers table.
3. Add the LineTotal field from the Customers table.
9. Resize the map to show all states, and then see how the sales are clustered in one area.
10. View the data for California(CA), and then change the format of the SalesYTD column to $ English
(United States).
12. Save the report, and leave it open for the next exercise.
Results: After this exercise, you should have created a report that has chart visuals and is ready to publish
to the Power BI service.
MCT USE ONLY. STUDENT USE PROHIBITED
6-30 Interactive Data Visualizations
4. When the report has published, click Open 'AdventureWorksLT Sales.pbix' in Power BI.
3. Pin the Top Selling Customers visual to the AdventureWorksLT Sales dashboard.
4. Pin the Orders by Main Category visual to the AdventureWorksLT Sales dashboard.
5. Pin the Top 10 Selling Bikes visual to the AdventureWorksLT Sales dashboard.
6. Pin the Sales by Main Category visual to the AdventureWorksLT Sales dashboard.
7. Open the dashboard from the link under the My Workspace pane.
8. On the Target Sales tile, open the menu, and then in Tile details, give the chart a subtitle of Sales
target for 2016.
9. On the Top Selling Customers tile, open the menu, and then in Tile details, give the chart a subtitle
of Customers selling the most products.
10. Open the Top 10 Selling Bikes tile in Focus mode. Filter LineTotal from 32000 to 40000.
11. Click Back to AdventureWorksLT Sales.
12. Click Enter Full Screen Mode. Notice that the browser is hidden.
13. Press Esc to exit full-screen mode and close Internet Explorer.
14. Close Power BI Desktop, and then close Excel and SQL Server Management Studio without saving any
changes.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 6-31
Results: After this exercise, you should have published a report to the Power BI service and used the
visuals to create a dashboard.
Question: Discuss the tools that you used to shape and combine data in the labs. How did
this compare to using Excel, or coding Transact-SQL to deliver the same results? Do you
think it is quicker to use Power BI rather than the applications that you currently use?
Question: Discuss some of the visualizations that you used in the optional exercise to create
a report that was relevant for your organization. If you did not have time to do the optional
exercise, which of the charts that you used in the lab will you reuse to create reports for your
organization? Can you think of data that you can present by using the map charts?
MCT USE ONLY. STUDENT USE PROHIBITED
6-32 Interactive Data Visualizations
Review Question(s)
Question: Why do you think the Manage Data portal prevents you from deleting data
sources? Do you agree with this, or should you be able to delete the data sources for the
queries that you have shared?
MCT USE ONLY. STUDENT USE PROHIBITED
7-1
Module 7
Direct Connectivity
Contents:
Module Overview 7-1
Module Overview
Power BI service supports live direct connections to Azure SQL Database, Azure SQL Data Warehouse, big
data sources such as Spark on Azure HDInsight®, and SQL Server Analysis Services. DirectQuery means
that whenever you slice data or add another field to a visualization, a new query is issued directly to the
data source.
Power BI works with SQL Server Analysis Services models that are running in multidimensional mode, so
that you can use OLAP cubes and models in reports and dashboards. It doesn’t matter if you are using the
Power BI service in the cloud, and an on-premises SQL Server Analysis Services implementation; the On-
premises data gateway enables live connections between the cloud and on-premises data servers.
Objectives
After completing this module, you will be able to:
Use Power BI direct connectivity to access data in Azure SQL Database and Azure SQL Data
Warehouse, in addition to big data sources, such as Hadoop.
Use Power BI with SQL Server Analysis Services data, including Analysis Services models running in
multidimensional mode.
MCT USE ONLY. STUDENT USE PROHIBITED
7-2 Direct Connectivity
Lesson 1
Cloud Data
In this lesson, you will learn how to use Power BI to directly connect to Azure SQL Database and Azure
SQL Data Warehouse, and then use these datasets with visualizations, reports, and dashboards. You will
then learn how Power BI works with big data sources, including Hadoop and Spark.
Lesson Objectives
After completing this lesson, you will be able to:
Use direct connectivity in Power BI to access data in Azure SQL Database and in Azure SQL Data
Warehouse.
Connect Power BI to big data sources and use these sources with BI reports and visualizations.
Note: Microsoft recommends that you allow access at the database level in Azure, rather
than at the server level.
2. Select More, and then in the Get Data dialog box, click Azure.
4. In the Server name box, type or paste the full name of the server—for example, <server
name>.database.windows.net—then optionally in the Database (optional) box, type the name of
the database. If you have previously created a parameter, Power BI gives you the option of using a
parameter value for the server and database names.
5. Type or paste an optional query into the SQL Statement (optional) box, and then click OK.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 7-3
6. If you did not specify a database name in the previous step, the Navigator screen displays a list of
available databases; otherwise, it just shows the database that you specified. Expand a database to
view the objects in it, and then click to select the tables and views that you want to import. You can
select objects from multiple databases to combine the data into a single dataset.
7. Click Load to import the data into Power BI, or click Edit to open the Query Editor window and apply
transformations. Transformations can also be performed at any point after loading the data.
Note: The Power BI Q&A natural language feature is not available when using DirectQuery.
Q&A uses the data that is imported into datasets to build answers and cannot create this without
the data being present.
After creating a report by using DirectQuery, you can publish to the Power BI service. You may need to
provide credentials for the database in Azure SQL Database to run the report. To provide credentials:
1. In Power BI, click the Settings gear icon, and then on the menu, click Settings.
2. Click the Datasets tab, and then click the dataset that connects to the database in Azure SQL
Database by using DirectQuery.
3. Click Edit Credentials, and then add your user name and password.
1. In the My Workspace pane, click Get Data from the navigation pane.
2. In the Databases box, click Get, click Azure SQL Database, and then click Connect.
3. In the Connect to Azure SQL Database box, type or paste the fully qualified name of the server —
for example, <server name>.database.windows.net.
4. In the Database box, type the name of the database.
5. If you want to set the data refresh interval, toggle Enable Advanced Options. You can set whether
you want the data to be refreshed in minutes or hours, and the frequency.
6. The Custom Filters box enables you to optionally enter filtering code, such as a SELECT statement, to
query the database.
7. Click Next, complete the Username and Password boxes, and then click Sign in. The data loads into
a dataset that has the same name as the database to which you connected. You can now begin
creating reports and dashboards by using the dataset.
You can connect to a database in Azure SQL Data Warehouse in much the same way as you connect to a
database in Azure SQL Database. After you have created the database in Microsoft Azure, ensure that you
have configured the firewall settings to give access to your own IP address, or a range of IP addresses.
Again, it is best to give access at the database level rather than at the server level.
MCT USE ONLY. STUDENT USE PROHIBITED
7-4 Direct Connectivity
2. Select More, and then in the Get Data dialog box, click Azure.
3. Click Microsoft Azure SQL Data Warehouse, and then click Connect.
4. In the Server name box, type or paste the full name of the server—for example, <server
name>.database.windows.net—and then optionally in the Database (optional) box, type the
name of the database. If you have previously created a parameter, Power BI gives you the option of
using a parameter value for the server and database names.
5. Type or paste an optional query into the SQL Statement (optional) box, and then click OK.
6. If you did not specify a database name in the previous step, the Navigator screen displays a list of
available databases; otherwise, it just shows the database that you specified. Expand a database to
view objects, and then click to select the tables and views that you want to import. You can select
objects from multiple databases to combine the data into a single dataset.
7. Click Load to import the data into Power BI, or click Edit to open the Query Editor window and apply
transformations. Transformations can also be performed at any point after loading the data.
1. In the My Workspace pane, click Get Data from the navigation pane.
2. In the Databases box, click Get, click Azure SQL Data Warehouse, and then click Connect.
3. In the Connect to Azure SQL Data Warehouse box, type or paste the fully qualified name of the
server—for example, <server name>.database.windows.net.
4. In the Database box, type the name of the database.
5. If you want to set the data refresh interval, toggle Enable Advanced Options. You can set whether
you want the data to be refreshed in minutes or hours, and the frequency.
6. The Custom Filters box enables you to optionally enter filtering code, such as a SELECT statement, to
query the database.
7. Click Next, complete the Username and Password boxes, and then click Sign in. The data loads into
a dataset that has the same name as the database to which you connected. You can now begin
creating reports and dashboards by using the dataset.
Opening in Power BI
After creating a database in Azure SQL Data Warehouse, you can use the Open in Power BI button to
begin importing data into the Power BI service:
In Microsoft Azure, navigate to the database in Azure SQL Data Warehouse, and then click Open in
Power BI. This opens the connection screen in Power BI, with the Server and Database boxes
prepopulated with the fully qualified server name, and the name of the database that you selected in
Microsoft Azure.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 7-5
There are several ways to use Power BI to connect to big data sources, and to use Power BI reports and
visualizations with big data.
Connecting to HDFS
If you have an Azure virtual machine running Hadoop, or are using a Hortonworks Sandbox (if you don’t
have access to a Hadoop cluster) you can connect to the Hadoop Distributed File System (HDFS) for
reporting with Power BI Desktop:
3. Click Connect.
Note: To avoid potential name resolution problems, you should add the IP address and
host name of the Hortonworks or Hadoop cluster details to the host file of the computer running
the queries.
Connecting to Spark
Azure HDInsight provides a fully managed Spark service. Apache Spark is an open-source parallel
processing framework that supports in-memory processing to boost the performance of big data analytic
applications. This capability allows for scenarios such as iterative machine learning and interactive data
analysis.
You use Power BI to connect directly to your Spark cluster then explore and monitor data without
requiring a data model as an intermediate cache. It's a live connection, so any field selection or filter sends
a query back to the source and the visual is updated with the new results. After saving your report, any of
the visuals can be pinned to your customized dashboard. The data in the dashboard will be refreshed
approximately every 15 minutes—no refresh schedule is required.
1. In the My Workspace pane, click Get Data from the navigation pane.
3. Click Connect.
4. Type or paste the fully qualified name of the server; for example,
<clustername>.azurehdinsight.net.
5. Complete the Username and Password boxes, and then click Sign in.
6. Click Connect.
7. Select the newly created Spark dataset to begin exploring the data. Note that every field selection will
generate a query back to the source data so, depending on the size of the query and any database
optimizations, there might be some loading indicators while the visuals are created.
Demonstration Steps
Import Data from Tables in a Database in Azure SQL Database
1. Ensure that the MSL-TMG1, 20778A-MIA-DC, and 20778A-MIA-SQL virtual machines are running,
and then log on to 20778A-MIA-SQL as ADVENTUREWORKS\Student with the password
Pa$$w0rd.
4. In the Get Data dialog box, click Microsoft Azure SQL Database, and then click Connect.
5. In the SQL Server database window, in the Server box, type the URL of the Azure server <Server
Name>.database.windows.net (where <Server Name> is the name of the server that you created).
6. In the Database (optional) box, type AdventureWorksLT, and then click OK.
7. In the SQL Server database dialog box, click Database.
11. In the Fields pane, notice that the three tables have been added. When the report is published to the
Power BI service, the tables are combined into a single dataset.
1. In the menu of the left, click Relationships, and then expand the SalesLT SalesOrderDetail, SalesLT
SalesOrderHeader, and SalesLT Customer tables to display all columns.
2. Position the cursor on the relationship arrow between SalesLT SalesOrderDetail and SalesLT
SalesOrderHeader. Notice that the related columns are highlighted.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 7-7
3. Position the cursor on the relationship arrow between SalesLT SalesOrderHeader and SalesLT
Customer. Point out that the related columns are highlighted.
4. In the menu of the left, click Report to return to the report canvas.
5. Drag the CompanyName field from SalesLT Customer onto the canvas to create a table.
6. Drag the LineTotal field from SalesLT SalesOrderDetail onto the Customers table on the report.
8. Drag the right edge of the chart to stretch it across the report and display the customers in full.
9. In the Visualizations pane, click Format, expand Title, and then rename the chart Line Total by
Company Name.
10. Click on the canvas, and then drag the CompanyName field from SalesLT Customer onto the
canvas to create a table below the chart.
11. Drag the OrderQty field from SalesLT SalesOrderDetail onto the Customers table on the report.
13. Drag the right edge of the chart to stretch it across the report and display the customers in full.
14. In the Visualizations pane, click Format, expand Title, and then rename the chart Order Quantity
by Company Name.
15. Expand Data colors, and then select a different color from the Default color selector.
16. Click on the canvas, drag the CompanyName field from SalesLT Customer onto Page level filters.
Lesson 2
Connecting to Analysis Services
In this lesson, you will learn how to use Power BI Desktop to connect to a local SQL Server Analysis
Services server, and then use the results in visualizations and reports. You will also learn how to access on-
premises SQL Server Analysis Services data from the Power BI service in the cloud, through the On-
premises data gateway. Finally, you will learn how to use Power BI with SQL Server Analysis Services
models that are running in multidimensional mode, and how to use OLAP cubes and models in reports
and dashboards.
Lesson Objectives
After completing this lesson, you will be able to:
Use the Power BI service, and the On-premises data gateway, to access on-premises SQL Server
Analysis Services data.
Use Power BI Desktop to connect to SQL Server Analysis Services models in multidimensional mode.
You can connect to an on-premises tabular model database in SQL Server Analysis Services (SSAS) from
both Power BI Desktop and the Power BI service (covered in the next lesson). For tabular models, the
installation of SQL Server Analysis Services must be SQL Server 2012 or later. You also have the option of
connecting to SQL Server Analysis Services by using Excel®, and then uploading the workbook. By using
Excel, you can explore and edit your tabular data in Power BI. In Power BI Desktop, you can also connect
to multidimensional models in SQL Server Analysis Services.
2. In the Server box, type the name of the server, and then optionally in the Database (optional) box,
type the name of the database. If you have previously created a parameter, Power BI gives you the
option of using a parameter value for the server and database names.
3. Toggle your connection between Connect live or Import data. In addition, you have the option to
enter Multidimensional Expressions (MDX) code or a Data Analysis Expressions (DAX) query. Click OK.
4. In the next dialog box, type your credentials, and then click Connect.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 7-9
5. Click to add dimensions and measures from the list of available objects.
6. Click Load to create the dataset and import the data if you previously selected this option, or click
Edit to open the Query Editor window and apply transformations. You can also edit the dataset later,
after loading it.
Before you can connect to SQL Server Analysis Services by using a live connection from the Power BI
service, you must configure a Power BI gateway on your server. This is applicable to both tabular and
multidimensional models. You can also use the gateway for the scheduled refresh of data that is imported
to Power BI. The gateway runs as a Windows® service on the server running SQL Server Analysis Services.
However, users need a Power BI Pro subscription to view content through the gateway. For more
information about setting up and configuring a gateway, in addition to determining if you need one, see
the following article:
Power BI Gateway – Enterprise
http://aka.ms/Y3jbnd
4. You will see a list of servers that are available. Power BI Gateway – Enterprise must be installed to
enable a connection to SQL Server Analysis Services from the Power BI service.
Personal gateway.
1. From the Power BI service, in the Downloads menu, select Data Gateway. The gateway should be
installed on a machine that can be constantly left running. The gateway is only supported on 64-bit
Windows operating systems.
MCT USE ONLY. STUDENT USE PROHIBITED
7-10 Direct Connectivity
a. On-premises data gateway: Multiple users can share and reuse a gateway in this mode. This
gateway can be used by Power BI, PowerApps, Flow or Logic Apps. For Power BI, this includes
support for both schedule refresh and DirectQuery.
b. Personal: This is for Power BI only and can be used as an individual without any administrator
configuration. This can only be used for on-demand refresh and schedule refresh. This will launch
the installation of the personal gateway.
Note: If you install the gateway in personal mode, you cannot install another gateway on
the same machine.
After data gateway installation, if the gateway is for Power BI, log in to the Power BI service and add your
data sources to the gateway within the Power BI service. This is done within the Manage gateways area.
The data gateway registers the Analysis Services models in the Power BI service.
Installing and configuring a gateway is usually done by an administrator. It might require special
knowledge of your on-premises servers and, in some cases, may require Server Administrator permissions.
A Power BI Pro license is required to use the gateway. For more information, see the following article:
On-premises data gateway in-depth
https://aka.ms/qkkwfu
1. In the Power BI service, click Get Data, then click Databases and select the option for SQL Server
Analysis Services.
2. Click Connect to see a list of all the Analysis Services models that were registered when the gateway
was configured. If there are no servers listed here, it means either that the gateway, and data source,
are not configured, or that your account is not listed in the Users tab of the data source, in the
gateway.
When you select one of the tabular models that are available on the SSAS machine and click Connect, a
dataset is added for you to use within the Power BI service; this is a pointer to the Analysis Services model.
When you open this dataset in Power BI, the list of tables that are available in the model is shown in the
right pane.
You can now build your visuals in the normal way, but by working on live data from the Analysis Services
machine. You can save your work as an Analysis Services Report and you can pin the report to a
Dashboard. The gateway passes credentials to Analysis Services so that, if this Dashboard is shared with
other users in your organization, these users will only see the data that they are permitted to access from
within Analysis services.
Note: If you pin visuals from a report to the dashboard, the pinned tiles are automatically
refreshed every 10 minutes. So, if data in your on-premises Analysis Services server is updated,
the tiles will get auto-updated within this 10-minute period.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 7-11
SAP HANA
In addition to SQL Server, you can now add SAP HANA as a DirectQuery data source. After your SAP
HANA data source has been set up, you can create and publish Power BI Desktop reports and view or edit
these reports with up-to-date data in Power BI. For SAP HANA, you must ensure that you have also
installed the SAP HANA ODBC driver on the same computer where the gateway is running. You can
download the driver from the SAP download page.
2. In the Server box, type the name of the server that is running a multidimensional model.
3. Ensure that the option to Connect live is selected, and click OK.
4. You can now browse the databases and the cubes, models, or perspectives that are available to you
on that server. When you connect to a perspective, you get a preview of the dimensions or measures
that are available—click OK and the fields list is populated. You are not importing any data into the
Power BI Desktop; in the bottom right-hand corner, you can see that you are using a direct
connection and that you are connected to an OLAP cube.
You can now build visualizations in the same way as you would do with any other data source; the only
difference is that you are sending queries to the multidimensional cube every time you make a change to
a visual. You can also use KPIs that are defined in the cube, and visuals display an indicator showing you
where the KPI is in relation to a target. If you then break data down by category, you can get status
indicators for each category.
As a BI professional, you have been asked to create a report in the Power BI Desktop that uses
DirectQuery pull data from the AdventureWorks data sources in Azure SQL Database. You have also been
asked to ensure that this information is made available from the cloud, by publishing this desktop report
to the Power BI service.
Objectives
After completing this lab, you will be able to:
Configure a live connection from the Power BI Desktop to an Azure SQL Database, by using
DirectQuery.
Publish a desktop report that includes a DirectQuery to an Azure SQL Database, for use from the
Power BI service.
Estimated Time: 60 minutes
In this exercise, you will create a Power BI Desktop report and use DirectQuery to pull data from the
AdventureWorks database hosted in Azure. You will then publish this report to the Power BI service, so
that this information is also available for cloud use.
The main tasks for this exercise are as follows:
5. Add the OrderQty field from the SalesLT SalesOrderDetail table to the chart.
7. Add the SellStartDate field from the SalesLT Product table to the slicer.
4. Sign in using the credentials you used to sign up for Power BI service.
5. Go to the newly created report. You should already have a card visualization for the OrderQty and a
slicer for the SellStartDate.
7. Add the LineTotal field from the SalesLT SalesOrderDetail table to the chart.
Results: At the end of this exercise, data from the AdventureWorks Azure SQL Database will be available
for use in Power BI Desktop and in a desktop report that has been published to the Power BI service.
Question: Discuss the different online data sources that your organization could use to
create Power BI reports. Can you think of a scenario where users perhaps have Azure SQL
database for one set of reports, and data in another online database for another set of
reports? Could this be combined into a single dataset in Power BI?
Question: Discuss the issues to consider when deciding whether to import data or use
DirectQuery when building reports against large online databases. Ask students about their
own organizations—ask them how they would make such a decision.
MCT USE ONLY. STUDENT USE PROHIBITED
7-14 Direct Connectivity
Use Power BI direct connectivity to access data in Azure SQL Database and Azure SQL Data
Warehouse, in addition to big data sources, such as Hadoop.
Use Power BI with SQL Server Analysis Services data, including Analysis Services models running in
multidimensional mode.
Review Question(s)
Question: Discuss the different ways in which your organization could use Power BI to
connect to online data sources. What would be some of the potential benefits of direct
connectivity to services such as Azure SQL Database? Are there any scenarios in your
organization that could use the On-premises data gateway?
MCT USE ONLY. STUDENT USE PROHIBITED
8-1
Module 8
The Developer API
Contents:
Module Overview 8-1
Module Overview
The Power BI™ Developer API is a REST-based API that developers use to access programmatically
Datasets, Tables, and Rows in Power BI. Using this API, you can push data from an application into Power
BI and integrate Power BI visualizations into an application. You can use the Power BI Interactive API
Console for learning about the Power BI APIs, and for trying out all Power BI REST API calls without
writing code. You can also add custom visuals to your applications, and to Power BI dashboards and
reports. Use the Power BI visuals gallery to share your own custom visualizations, and to access visuals
created by others in the Power BI community.
After you have written an application, you must register it with Power BI and with Active Directory®. You
can create custom visualizations, and see how custom visuals are added to reports, dashboards, and
content packs. The Power BI developer center (http://dev.powerbi.com) provides links for starting the
registration process for web applications or native client applications.
Objectives
After completing this module, you will be able to:
Describe the Power BI Developer API, how developers can use this API to create applications, and the
registration process for new applications.
List the steps for creating custom visualizations, and import custom visuals into Power BI for use in
Power BI reports.
MCT USE ONLY. STUDENT USE PROHIBITED
8-2 The Developer API
Lesson 1
The Developer API
In this lesson, you will learn how the Power BI developer API can be used in applications, to push data into
Power BI, add data visualizations into applications, and create custom visualizations. You will also learn
how to use the Power BI Interactive API Console to launch API calls against datasets, and how to register a
finished application with Power BI and with Active Directory.
Lesson Objectives
After completing this lesson, you will be able to:
Describe the key tasks that can be completed using the Power BI Developer API.
Use the Power BI Developer Center to register apps with the Power BI service and with Azure Active
Directory.
Extending existing business workflows to push key data into a Power BI dashboard.
1. Register a web app with Azure AD. You need to register your web app so that Azure AD can identify
your application when you need to access Power BI tiles.
Local. If you save data to a local drive on your computer, or another storage location within your
corporate network, you can import PBIX files into the Power BI service, or you can publish reports
from the Power BI Desktop into Power BI.
OneDrive – Business. If you save data to OneDrive for Business, and you sign into OneDrive with the
same account that you use to sign into Power BI, Power BI can connect directly (as both are in the
cloud) to your file on OneDrive. Datasets, reports, and dashboards are automatically updated in
Power BI every hour.
OneDrive – Personal. Power BI can also connect directly if you use a personal OneDrive account to
save desktop data, in a similar way to OneDrive for Business. However, when you first connect to your
file, you will need to sign in to OneDrive with your Microsoft account—this is usually different from
what you use to sign in to Power BI—and select the Keep me signed in option.
SharePoint Team-Sites. Saving desktop files to SharePoint – Team Sites is much the same as saving
to OneDrive for Business, except that you specify a URL or connect to the root folder.
If you use Publish from the Power BI Desktop to push data to the Power BI service, this achieves the same
result as using Get Data in the Power BI service to pull data by importing a file from a local drive or
connecting to it on OneDrive.
MCT USE ONLY. STUDENT USE PROHIBITED
8-4 The Developer API
The key steps for authenticating a Power BI web app and performing a REST web request are as follows:
When using the interactive API, a typical first task is to use the API to query for any datasets that are
currently stored in Power BI.
By using the datasets collection, you see the different API calls that you can make:
1. Click List all Datasets: the console results pane on the right then displays the web service that you
can call, the URL to use, details of the type of request that you need to send, and the format of the
results.
5. The API call will list the datasets that are available.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 8-5
You can use these interactive APIs to create new datasets, add data by adding rows to tables, and so on.
For web applications, enter a redirect URL—the URL within your application that is used when the
user has logged in. You also need to enter a home page URL, such as a page that has more
information about your application.
Select the APIs to which this application will have access. For example, the push API is used to read or
write in datasets; the report and dashboard APIs pull tiles into the application; and there is an API for
accessing Power BI groups.
Click Register App to register the application. The registration generates a Client ID and a Client
Secret. For a web application, you would now take these strings and paste them into the relevant
sections of the web.config file.
The registration process is similar for client apps, except that a home page URL is not required, and only a
Client ID is returned.
Demonstration Steps
Using the Developer API in the Interactive Console:
1. Start the MSL-TMG1, 20778A-MIA-DC, and 20778A-MIA-SQL virtual machines, and then log on to
20778A-MIA-SQL as ADVENTUREWORKS\Student with the password Pa$$w0rd.
MCT USE ONLY. STUDENT USE PROHIBITED
8-6 The Developer API
4. In the right console pane, describe the results that are now displayed, such as the GET URL, and the
example Response body.
7. In the Sign in to your account dialog box, enter the credentials you used to sign up for Power BI
service, and then click Sign in.
8. On the Apiary for Power BI page, click Accept.
9. If the right console pane has not refreshed, click List all Dashboards.
Registering an App
2. Scroll down the page, and under Client app, click Register your app.
4. Sign in using the credentials you used to sign up for Power BI service.
8. In the Client ID box, select the text, and copy the string.
9. Paste the text into Notepad; point out that this string would now be used in the app.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 8-7
Lesson 2
Custom Visuals
In this lesson, you will learn how the Microsoft Power BI visuals project is used to create custom
visualizations, and how custom visuals can be added to reports, dashboards, and content packs. You will
also learn about how custom visuals can be shared through the Power BI visuals gallery.
Lesson Objectives
After completing this lesson, you will be able to:
Describe the process used for creating custom visualizations for use with Power BI applications and
dashboards.
Import custom visuals from the Power BI visuals gallery into Power BI, and use these visualizations in
Power BI reports.
1. The init method. This method is called once when your visual is about to be put on the screen. In its
options, there will be an HTML element where the visual will be rendered.
2. The update method. This method contains most of the code logic. This method is called with options,
including the viewport and the data. The data is served in the form of a data view, which is typically
converted into your own view model before you render it.
3. The destroy method. This method is called when the visual is being removed from the screen, and
you wish to de-allocate unused resources or state.
4. The enumerate method. This method is used by the format pane to display the correct values.
MCT USE ONLY. STUDENT USE PROHIBITED
8-8 The Developer API
Data Binding
In addition to implementing the IVisual interface, the visual is also required to declare its capabilities. This
enables Power BI to determine what the visual is capable of doing, and to provide functionality for the
visual. The two most important capabilities are roles and mappings. These capabilities specify to Power BI
the kind of data buckets that the visual accepts, how many there are, and how these buckets map onto
the data view object that will be returned.
You can use the Power BI Playground on GitHub to test how visuals look by using the Web view or Mobile
view—the Mobile view offers Dashboard and In-focus views. The playground offers a list of visuals to
browse through, and see how they appear. You can view animations and interactions, in addition to
resizing the tile. A playground app is also included in the Microsoft Power BI visuals project.
For more information about creating custom visuals, ideas, and support, see the Developers category of
the Power BI blog.
Microsoft Power BI Blog
http://aka.ms/Yta0x4
1. Visit the community gallery, and click the visual that you want to use.
3. Read the terms, and if you agree, click I agree in the Licensing dialog box. The visual saves to the
default download folder that is specified in your browser's settings.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 8-9
5. In the Visualizations pane, click the Import from a file icon (...).
7. Browse to the download folder, select the visualization (.pbiviz) file, and then click Open.
8. When the Success confirmation dialog box appears, click OK. A new icon appears in the
Visualizations pane, and is ready to use.
9. Click the icon, and the visual appears on your report as a watermark template. Drag fields onto the
pane to add data.
10. The new visual now appears in the Visualization pane just like any other visual—to insert it, click that
option.
In addition to using custom visualizations within the Power BI Desktop, you can use them within Power BI
when you publish those reports to the service. To upload a custom visual that you have created, or
download a custom visual from the Power BI community gallery, see the following article:
Demonstration Steps
Import a Custom Visualization:
1. In Internet Explorer, go to https://app.powerbi.com/visuals.
2. In the Visuals library section, ensure that Custom visuals is selected, and then browse or search for
Donut Chart.
3. Click the Donut Chart visual, and then click Download Visual.
5. At the download prompt, click Save, and download the Donut Chart to a folder on your local
machine.
9. In the Visualizations pane, click the ellipsis (…), and then click Import a custom visual.
10. In the Caution: Import Custom Visual dialog box, click Import.
11. In the Open dialog box, browse to the location where you saved the Donut Chart, click Donut
Chart.x.x.x.pbiviz, and then click Open.
MCT USE ONLY. STUDENT USE PROHIBITED
8-10 The Developer API
1. In Power BI Desktop, in the Report view, at the bottom of the page, click the Company Report tab.
3. In the Visualizations pane, click the DonutChartGMO icon. Data that was previously displayed using
the Clustered column chart should now be displayed in the Donut Chart visualization.
4. Close Power BI Desktop, without saving any changes, and then close Internet Explorer.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 8-11
As a BI professional, you are asked to explore the use of custom visualizations, so that Adventure Works
employees can extract maximum value from sales datasets.
Objectives
After completing this lab, you will be able to:
In this exercise, you will apply the Sunburst custom visualization to an existing report and compare this
visualization with the standard visual that was previously in use.
The main tasks for this exercise are as follows:
6. Select the Order Quantity by Color and Sales Person visual, and modify it to use the Sunburst
visualization.
Results: At the end of this exercise, the Sunburst custom visualization will be used in a Power BI report.
Question: Do you think that the Sunburst visualization provides additional insights into the
Sales Order data, compared with the clustered column chart that was originally used?
Question: From your own experience, are there any other custom visuals from the Power BI
visuals gallery that would add value to the Sales Order data?
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 8-13
Review Question(s)
Question: Discuss the potential of the Power BI Developer API for your own organization.
Are there any particular Power BI-based applications that you already use, or would like to
see developed?
MCT USE ONLY. STUDENT USE PROHIBITED
MCT USE ONLY. STUDENT USE PROHIBITED
9-1
Module 9
Power BI Mobile
Contents:
Module Overview 9-1
Module Overview
Power BI™ mobile apps enable you to access and use Power BI information on a mobile device, including
iOS (iPad, iPhone, iPod Touch, Apple Watch), Android phone or tablet, and Windows® 10 device. This
means that, potentially, Power BI reports and Power BI dashboards created in Power BI Desktop and the
Power BI service can be used anywhere and at any time.
Power BI reports and dashboards are designed to work on a mobile device without modification.
However, you can also create specific optimized reports and report layouts for display on mobile devices.
The Power BI mobile apps support the sharing and annotation of dashboards, and you can use Power BI
data on mobile devices even when you are not connected to a network. Power BI alerts and notifications
also work across the Power BI service, including on mobile devices.
Developers can also use Power BI functionality to add visualizations and reports to web or mobile
applications by using Power BI Embedded, together with custom visualizations.
Objectives
After completing this module, you will be able to:
Create dashboards and reports that are optimized for mobile devices that use iOS, Android, and
Windows 10 operating systems.
Create and publish reports, share and annotate dashboards, and set alerts—and show that this data
can be used when mobile devices are offline.
Use Power BI Embedded to add visualizations and reports to web or mobile applications.
MCT USE ONLY. STUDENT USE PROHIBITED
9-2 Power BI Mobile
Lesson 1
Power BI Mobile Apps
In this lesson, you will learn how to view Power BI reports and dashboards on a mobile device, and
understand the features included in the mobile apps. You will also learn how to optimize report layouts
for display on mobile devices.
Lesson Objectives
After completing this lesson, you will be able to:
Understand the features of the Power BI app for iOS devices, including iPhone and iPad.
Describe the available features included in the Power BI app for Android devices.
Design Considerations
Although dashboard items scale to size, you might wish to pay attention to the visuals you include on a
dashboard and the level of detail. If you know the target device is a tablet or phone, you can make
allowance for the screen size. A bar chart with 30 columns might display perfectly on a tablet, but may be
more difficult to view on a mobile, even in landscape mode.
Note: If your organization uses Power BI Pro, and users connect using mobile phones, you
can create content packs with reports and dashboards designed for the smaller screen. You can
scale down the size of visuals, and ensure that the most important data is placed at the top of the
dashboard. These items are then shown first when you vertically scroll dashboard items.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 9-3
Offline Data
Power BI runs a background data refresh every two hours—if you go offline, data remains reasonably up
to date. While offline, you continue to have access to all items in My Workspace, and can interact with
dashboards. Power BI can cache up to 250 MB of data; however, data sources requiring an active
connection cannot show data. You can also view reports in read-only mode, but you cannot filter, sort, or
use slicers. To avoid data usage charges, you can turn off this scheduled refresh. An offline indicator
displays at the top of your dashboard when you have no signal. The offline data feature is currently only
applicable to devices running iOS and Android.
You do not need to sign in to Power BI to start using it on your iOS mobile device. The app includes
sample dashboards, so you can see if the app works before you sign in and view your organization’s
content. If you have an iPhone, it needs to be at least iPhone 5, running iOS 8.0.
Viewing Modes
When viewing dashboards on your iPhone in portrait mode, the tiles stack vertically, in the left to right
order of the tile placement, on the web version of the dashboard in Power BI service. If you turn your
phone sideways to view the dashboard in landscape mode, the dashboard tiles display exactly as they are
on the portal, which is useful for tiles that are grouped together contextually.
MCT USE ONLY. STUDENT USE PROHIBITED
9-4 Power BI Mobile
It’s easy to share your dashboards with colleagues. Open the dashboard you want to share, and tap the
ellipsis (…). Click Invite, then Invite a Colleague. Type the recipients’ names or email addresses in the
Add names or emails box. You can also include a message in the Add text box, and toggle the setting
to Allow recipients to share this dashboard. Click Send. The recipients receive an email message
inviting them to add the dashboard. This email expires after one month, and you can view whether
invitation requests have been accepted or not. You can only send emails to colleagues in the same
domain, and they need Power BI to view the dashboard. However, you can send a snapshot of a tile from
the iPhone app to anyone in or outside of your domain—but the recipient can’t interact with the tile or
open the dashboard.
Power BI QR Codes
The Power BI Mobile app for the iPhone includes a QR scanner, which means users can scan a QR code
that links directly to a dashboard tile, and opens in Power BI Mobile. Consider the following scenario: you
create a dashboard in the Power BI service for presenting to the senior managers in your organization;
you display the dashboard on a large TV in Full Screen Mode during the presentation—but you want the
managers to view the data in more detail during the meeting. By creating a QR code for those tiles that
need viewing in more detail, you can give the code to the managers, either on paper, in an email
message, or from your iPhone. The code opens the tiles directly in the Power BI app.
To generate a QR code, open the relevant dashboard in Power BI service. Click the ellipsis (…) on the tile
you want to create a code for, then click Focus mode to open the tile. Click the ellipsis (…), and then click
Generate QR code. After it has been generated, you can download the code as a .jpg file. You can use
this file in email messages and PowerPoint slides, or save it to your phone, or print it.
To scan a QR code, select QR Scanner from the main menu in Power BI Mobile, or use a QR scanner app
that is already installed on your mobile. Both methods require access to the camera on your phone, which
you must allow.
Groups
Power BI groups are built upon Office 365 groups—you can use them to collaborate with other members,
and interact with group reports and dashboards. You can view your groups in the Power BI for iOS app,
by tapping the Options icon, and then selecting a group. The group page is displayed.
Data Alerts
Data alerts can be added to tiles that display a single number. You can set thresholds to alert you when
the number goes above or below the value you set, or you can set both. For example, your organization’s
sales for the year currently show $27.31 million. You can add an alert so you are notified when this figure
reaches $30 million. For example, if you wanted to monitor your organization’s share price, you could set
an alert for when the value drops below $15, and goes above $25.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 9-5
To create an alert, open the tile that you want to monitor, and tap the Bell icon. Use the Above and
Below toggles to enable (or disable) the alerts, add your values, and then tap Save. The values are
checked each time the data in the dashboard is refreshed. The alerts you create are only available to you,
so if you share a tile, or dashboard, other users cannot see them—but they can create their own. You can
also create alerts on tiles imported through content packs.
Viewing Modes
On an Android phone, you can view dashboards in portrait mode, which arranges the tiles one on top of
another. For a uniform view, they all resize to the same width, filling the available screen space. Landscape
mode is also supported, meaning you can view a dashboard in the same layout as it was designed on the
Power BI service portal.
You can share dashboards using the Invite a colleague function, located under the ellipsis menu on the
dashboard view. If you are the dashboard owner, you can view the colleagues you have invited, and see
whether they have accepted your invitation. Type an email address and an optional message if you don’t
want the default Power BI message. Tap the Airplane icon to send the invitation. You can also allow
colleagues to share the dashboard with others. Dashboard owners can unshare a dashboard.
MCT USE ONLY. STUDENT USE PROHIBITED
9-6 Power BI Mobile
Power BI QR Codes
The Power BI for Android app includes a QR scanner, or you can use any of your other QR code scanner
apps. The scanner included with Power BI needs access to your phone’s camera, so you must allow this
before scanning. When you scan a QR code for a tile, it opens immediately after successfully interpreting
the code, either when you use the Power BI scanner, or an alternative scanner app.
Groups
You can use the Power BI for Android app to interact with group dashboards. Groups are listed under My
Workspace. Tap a group to show the group page, and display the dashboards belonging to the group,
then tap a dashboard to view it.
To enable the app to perform optimally, ensure your device has at least 1 GB RAM, and 8 GB internal
storage. After installing and opening the app, sign in to your Power BI account, and tap Start exploring
to view your dashboards.
Viewing Mode
The Power BI mobile app for Windows 10 supports viewing dashboards in portrait and landscape mode.
In portrait mode, tile items are vertically stacked and displayed with an identical width. Landscape mode
displays the dashboard exactly as it is on the Power BI Service.
Share Dashboards
You can share a dashboard with colleagues within your organizational domain. On the dashboards home
page, press and hold, and tap Invite. Add email addresses, and optionally include a message; otherwise
Power BI includes a default message. If you want the recipients to be able to share the dashboard, select
Allow recipients to share your dashboard. Tap the Send icon. You can see whether your colleagues
have accepted or rejected your invitation, or if the invitation is pending.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 9-7
If you have colleagues in a different domain, you can send a read-only snapshot. Open a dashboard, and
tap a tile to open it in Focus mode. Tap the Share Snapshot icon to share the tile.
Groups
View your groups by tapping the Navigation icon to show My Workspace. Tap a group to display the
dashboards that have been published to the group.
Search Facility
You can search for reports, dashboards, and groups. Tap the Search icon in My Workspace. Power BI
displays a list of recently viewed reports and dashboards, and recent groups. When you begin typing in
the Search box, Power BI shows you the best results.
You now get a view where the tiles are shown in the same layout as you would see on a mobile screen;
you can remove tiles, reorder tiles, and resize tiles. If you want to remove everything, and start from
scratch there is an option to unpin all the tiles; you can also reset the phone view to match the default
layout.
MCT USE ONLY. STUDENT USE PROHIBITED
9-8 Power BI Mobile
You can also optimize Power BI Desktop reports for mobile device consumption:
2. On the View tab, select Change Layout. You now get a blank phone canvas. All of the visuals on the
original report page are listed in the Visualizations pane on the right.
3. To add a visual to the phone layout, drag it from the Visualizations pane to the phone canvas.
4. To remove a visual, click the X in the top-right of the visual on the phone canvas, or select it and
press Delete. Removing a visual in this view only removes it from the Mobile canvas; the visual and
the original report will not be affected.
Phone reports use a grid layout. As you drag visuals to the mobile canvas, they snap to that grid. You can
add some or all of the master report page visuals to the phone report page. You can add each visual only
once. You can resize your visuals on the grid, as you would for tiles on dashboards and mobile
dashboards.
Note: The phone report grid scales across phones of different sizes, so your report will look
equally good on small- and large-screen phones.
For reports with multiple pages, you can optimize all the pages or only a few.
On a phone, you move between pages by swiping from the side or tapping the page menu.
You cannot modify formatting settings for just the phone. Formatting is consistent between master
and mobile layouts. For example, font sizes will be the same. So to change a visual, such as changing
its formatting, dataset, filters, or any other attribute, you must return to the regular report authoring
mode.
When in a phone report, changing the phone’s orientation to landscape will open the report in the non-
optimized view with the original report layout, whether you optimize the report or not. If you only
optimize some pages, readers will see a message in portrait view, indicating the report is available in
landscape; report readers can then turn their phones sideways to see the page in landscape mode.
Question: If you have an iOS, Android, or Windows 10 phone or tablet, download the Power
BI app if you don’t already have it. You do not need to sign in with a Power BI account,
because you can use the sample data. However, an account will be needed for the lab. Users
who do not have an account can create one using the following steps:
Ensure that the 20778A-1-MIA-DC and 20778A-1-MIA-SQL virtual machines are both
running, and then log on to 20778A-1-MIA-SQL as ADVENTUREWORKS\Student with the
password Pa$$w0rd.
Open Internet Explorer from the taskbar, and browse to the Office 365 Trial sign-up page,
and follow the instructions: http://aka.ms/Y682m2.
Explore the features of the Power BI app, and look at the samples and demo server if these
are available. Discuss useful features that could be added to improve the app, in addition to
features you like and don’t like, and how they could be useful in your organization.
MCT USE ONLY. STUDENT USE PROHIBITED
9-10 Power BI Mobile
Lesson 2
Using the Power BI Mobile App
In this lesson, you will learn how to create and publish reports specifically for mobile devices. You will also
learn about the features in the mobile apps that enable dashboards to be shared and annotated, and how
the apps enable Power BI data to be displayed offline. Finally, you will learn about Power BI alerts and
notifications, and how alerts work for mobile devices.
Lesson Objectives
After completing this lesson, you will be able to:
Share and annotate a snapshot of a tile, report, or visualization from the Power BI mobile app.
Use the Power BI Notification Center, and set alerts for the mobile apps and the online Power BI
service.
Report Gallery
You can create mobile device-specific reports, and
publish them to a report gallery for easy access.
These reports are created as Reporting Services
mobile reports by using SQL Server 2016 Enterprise
Edition Mobile Report Publisher—and there is an
option to use a mobile report layout. You publish
these reports to a SQL Server 2016 Reporting
Services web portal, where you can also create KPIs.
In the mobile app for Power BI, you can then view
these mobile reports and KPIs, organized in folders
or collected as favorites.
You can connect mobile reports to a range of data sources, including on-premises SQL Server and
Analysis Services data. You design the layout of your mobile reports on a design surface with adjusting
grid rows and columns, and flexible mobile report elements that scale well to any screen size. You then
save these mobile reports to a Reporting Service server, and view and interact with them in a browser or
in the Power BI mobile app on iPads, iPhones, Android phones, and Windows 10 devices.
Note: To use the Power BI mobile app to view reports and KPIs, you need to enable Basic
Authentication on your reporting server.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 9-11
4. Select the data source that you created in the previous step.
5. Select the option to save the data source to the SSRS server.
6. You can use this data set for KPIs and Mobile Reports; multiple data sets can be created using the
same data source.
7. To create a KPI from the server, select New KPI from the dropdown menu.
1. Download and install the SQL Server 2016 Enterprise Edition Mobile Report Publisher.
2. Start Mobile Report Publisher; you can start with visuals or with data. If you start with visuals, sample
data is automatically generated.
3. To add your own data, click Add Data, and select where your data is located. You can add local Excel
data or a shared dataset from your SSRS instance.
4. To create a phone layout, select Phone in the layout dropdown menu and design the report.
1. Ensure you have the latest version of the Power BI app downloaded to your device.
2. Once downloaded, when you first open the app, you’ll be greeted with a welcome slide.
4. Tap the options icon in the upper-left corner, and tap Connect to SSRS server.
5. Enter the server address and your user name and password. Use this format for the server address:
8. Click Connect.
9. Tap the options icon anytime to go between your Reporting Services mobile reports and your
dashboards in the Power BI service.
MCT USE ONLY. STUDENT USE PROHIBITED
9-12 Power BI Mobile
10. When you enter the app in the future, you will see the server in the menu that you have set up. You
can only have a single connection to Reporting Services at a time in the app (if you want to connect
to a different server, you need to disconnect from the current one).
The app will default to the KPI page as the first page you see in the future unless you are also connected
to a Power BI instance. It will default to Power BI when both services are connected.
KPIs and mobile reports can be marked as favorites in the Reporting Services web portal; you can then
view them in a single folder on your device, together with Power BI favorite dashboards and reports. You
can also mark KPIs and mobile reports as favorites within the Power BI mobile app.
Annotating Dashboards
You can share a snapshot of a tile, report, or
visualization from the Power BI mobile app for iOS,
Android, and Windows 10 devices as a mail
message. The snapshot shows the information as it
was at the time when the mail was sent, and
includes a link to the source tile, report, or
visualization. Snapshots can be sent to anyone but,
to access the current information through the link,
the recipient must have the appropriate permissions
and you must have already shared the dashboard
or report with them.
o To type comments, tap the text icon, choose the text size and color, and type.
o To paste stamps (such as emoticons): tap the smiley face, choose a color, and tap where you want
them.
3. Type the recipients' names, and (optionally) edit the standard message text.
4. Tap Send.
The mail message includes a link to the live version of the tile, report, or visualization. The message
recipients can click this link and go straight to that tile, report, or visualization, provided that:
The recipients have been assigned the appropriate permissions to the dashboard or report.
Wi-fi network. Background refresh updates the content every two hours.
If you do not want your device to use background refresh, you can turn it off, to prevent excessive
network usage, for example.
Note: For iOS devices that are managed by Microsoft Intune Mobile Application
Management (MAM) policies, background data refresh for the Power BI mobile app is turned off.
To refresh the data from the Power BI service, you must go into the app.
Offline Limitations
While offline, you can interact with cached dashboards and reports, with the following limitations:
Your access to Power BI reports is read-only.
You can see full reports, but you cannot filter, cross-filter, sort, or use slicers.
When working offline with the Power BI mobile app, you might also encounter the following additional
limitations:
Some tile types are not available offline, because they require an always-on server connection, such as
Bing map tiles.
Reporting Services mobile reports and KPIs can be viewed offline, providing you have viewed them
while connected. However, these reports and KPIs do not refresh in the background; instead, they
refresh when you open them.
MCT USE ONLY. STUDENT USE PROHIBITED
9-14 Power BI Mobile
Data Alerts
If you work in an organization where many
coworkers are using and sharing information, your
Power BI experience could potentially become
overwhelming; for example, as others share
dashboards with you, alerts are generated, and new
reports generated. The Power BI Notification Center
is designed to address this challenge.
Alerts are used to notify you when data in a dashboard changes beyond particular limits, and are used for
tiles that feature a single number, such as cards and gauges. Alerts are personal to you, and are not
shared with other users, even when you share a dashboard that includes a tile for which you have set an
alert.
Note: If your device gets stolen, you should connect to the Power BI service to turn off all
data-driven alert rules, to prevent any alert notifications on that device from providing
information about your data to an authorized user.
Setting an Alert
The following steps show how to set an alert in the Power BI app for iOS (the steps for Android and
Windows 10 devices are similar):
4. Select to receive alerts above or below a value, then set the value.
5. Select whether to receive hourly or daily alerts, and whether to also receive an email when you get
the alert.
7. Tap Save.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 9-15
Receiving Alerts
Alerts are received into the Power BI Notification Center on your mobile device or in the Power BI service;
this is also where you get any notifications about new dashboards that have been shared with you. Alerts
are only generated as data is refreshed; after a refresh, if data reaches an alert threshold, the following
occurs:
1. The Power BI service checks when the last alert was sent.
2. Depending on the alert interval option you configured for the alert (every hour or every 24 hours, for
example) a new alert will be generated.
3. If the alert is configured to send an email message, the email will be sent.
4. Power BI adds a message in the Notification center, and adds a new alert icon to the applicable tile.
5. On a mobile device, tap the global navigation button to open the mobile Notification center and see
the alert details.
MCT USE ONLY. STUDENT USE PROHIBITED
9-16 Power BI Mobile
Lesson 3
Power BI Embedded
In this lesson, you will learn about Power BI Embedded, an Azure service that enables developers to add
visualizations and reports to web or mobile applications. You will also learn how to create custom
visualizations that can be used with these applications, and in other Power BI scenarios. You will also learn
about the Power BI Community, and how this online forum can help you can learn more about Power BI
and connect to other BI professionals.
Lesson Objectives
After completing this lesson, you will be able to:
List the key features of Power BI Embedded, and explain how developers can use this Azure service to
add visualizations and reports to web or mobile applications.
Describe how to create custom visualizations for use with Power BI in web and mobile applications.
Use the Power BI Community to learn more about Power BI and connect to other BI professionals.
The same access key is used in each workspace collection; the workspace collection represents the security
boundary for Power BI Embedded. Therefore, if you are developing applications for different customers,
you should create separate workspaces for each customer, and then add workspaces per customer
application in each workspace collection.
Power BI Embedded is intended for applications that are provided for third-party use, and is not designed
for internal use. If you want to use Power BI to create an internal business application, the Power BI service
provides its own content embedding capabilities, where users are required to have a valid Power BI Free
or Power BI Pro user subscription license.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 9-17
Power BI Embedded uses an application token authentication model to control access to the Power BI
workspaces used by the application. Power BI Embedded supports access to cloud data sources that use
basic credentials via Direct Query; this currently includes sources such as Azure SQL Database and Azure
SQL Data Warehouse. You can use tools such as .NET (C#) or Node.js SDK to build your application with
Power BI Embedded.
2. View Power BI API Access Keys. Access Keys are used to generate the app tokens that are, in turn,
used to authenticate Power BI REST API requests. Access keys should be stored securely in the
application.
3. Create Power BI datasets and reports to embed into an app. The Power BI Datasets and reports to
be used in the application can be created by using Power BI Desktop; you save your work in Power BI
Desktop, to create a PBIX file. If you import data into Power BI Desktop, the PBIX contains the
complete dataset; if you use DirectQuery, the PBIX contains just a dataset schema.
4. Import the report into your app. To embed the report into the application, you use the Power BI
Import API to programmatically import the PBIX into your workspace.
Power BI Community
The Power BI Community is a free website where
you can learn more about Power BI and connect to
other BI professionals. To get started, you register
and create a profile. This is a separate registration
to the login you use for the Power BI service,
requiring a unique username, password, and email
address. You can use the same email address that
you use for the Power BI service. Your profile is
visible to other users, who can view your posts and
activity, and add you as a friend. You use the
messaging feature to send and receive private
messages to and from other community members.
You can personalize your profile to include a photo or avatar, and add links to your social media profiles
such as Twitter and Facebook.
The Getting Started with the Power BI Community page provides detailed information and
instructions on using the website. The community comprises the following main sections:
Forums
The forums are an incredibly useful source of knowledge for finding solutions to problems you have
encountered, or for discovering how to master a task. You can search existing posts, or browse through
the main topic areas. Each post includes an options menu, offering numerous useful features, including
bookmarking the post, subscribing to the post to be informed of new comments, and sending the post to
a friend. Experienced users and moderators all contribute to helping the community resolve their issues
and answer questions.
Ideas
Microsoft encourages users to submit feedback and suggestions for continuous product improvements to
Power BI. In addition to being able to submit a suggestion for a new feature, or a better way for an
existing feature to operate, community members can vote on suggestions, so that Microsoft develops the
most popular features first.
Events
For free training and learning, visit the Events page to find meetings local to you, or online meetings.
These events include official Microsoft meetings, in addition to user group meetings. You use the options
menu to subscribe to the events page, receive events via RSS, and invite a friend to join the community.
User Groups
You can find established user groups, and get information on how to start one if you don't have one near
to where you live. Use the Notify me link to add your location and receive alerts if a new group starts up,
or you can suggest an existing group partners with you. The program managers at Microsoft post
comments to inform the community when works begins on a feature.
Community Blog
The community blog comprises articles, guides, and information specific to Power BI, written by
community members. You can also use the options menu to subscribe to the blog to receive updates
when new blogs are published, obtain updates as an RSS feed, and invite a friend to join. Furthermore,
you can bookmark articles you like and reread them as required.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 9-19
When you give a “thumbs-up” to like an article, this gives it kudos. Authors earn kudos badges by
collecting likes from other members. If you have written an article that you would like to publish to the
community blog, you contact the Admin team and submit your work.
For more information, and to interact with the Power BI community, use the following link:
Power BI Community
https://aka.ms/qfx3ay
MCT USE ONLY. STUDENT USE PROHIBITED
9-20 Power BI Mobile
You also learned about how developers can use the power of Power BI by using the Power BI Embedded
service to add visualizations and reports to web or mobile applications.
Review Question(s)
Question: Discuss the types of information that are likely to work best on a mobile device.
Ask students how they think Power BI mobile apps could be used in their own organizations,
and which types of visualizations and data formats they would choose for mobile reports and
dashboards.
MCT USE ONLY. STUDENT USE PROHIBITED
Analyzing Data with Power BI 9-21
Course Evaluation
Your evaluation of this course will help Microsoft understand the quality of your learning experience.
Please work with your training provider to access the course evaluation form.
Microsoft will keep your answers to this survey private and confidential and will use your responses to
improve your future learning experience. Your open and honest feedback is valuable and appreciated.
MCT USE ONLY. STUDENT USE PROHIBITED
MCT USE ONLY. STUDENT USE PROHIBITED
L1-1
5. When the script is complete, press any key to close the window.
6. If you do not have a Power BI login, open Internet Explorer, browse to
https://powerbi.microsoft.com/en-us/documentation/powerbi-admin-signing-up-for-power-
bi-with-a-new-office-365-trial, and then follow the steps to create an account.
7. In Internet Explorer, browse to https://www.microsoft.com/en-
us/download/details.aspx?id=45331, and then click Download.
8. On the Choose the download you want page, select the PBIDesktop_x64.msi check box, and then
click Next.
10. In the Microsoft Power BI Desktop (x64) Setup dialog box, on the Welcome to the Microsoft
Power BI Desktop (x64) Setup Wizard page, click Next.
11. On the Microsoft Software License Terms page, select the I accept the terms in the License
Agreement check box, and then click Next.
13. On the Ready to install Microsoft Power BI Desktop (x64) page, click Install.
15. On the Completed the Microsoft Power BI Desktop (x64) Setup Wizard page, clear the Launch
Microsoft Power BI Desktop check box, and then click Finish.
17. On the desktop, right-click the Power BI Desktop shortcut, and then click Pin to Taskbar.
2. If the security warning appears to say “External Data connections have been disabled”, click Enable
Content.
3. On the SalesPerson tab, click any cell in the table and select it so the Design tab appears.
MCT USE ONLY. STUDENT USE PROHIBITED
L1-2 Analyzing Data with Power BI
6. In the new worksheet, in PivotTable Fields, select the FirstName check box to add this to the Axis,
and then select the SalesYTD check box, to add this to Values.
8. In the Insert Chart dialog box, leave Clustered Column selected, and click OK.
10. In the Move Chart dialog box, click New sheet, type Sales Person Chart, and then click OK.
11. On the File tab, click Save As, and then click Browse.
12. In the Save As dialog box, in the file location bar, type http://mia-sql/sites/adventureworks, and
then press Enter.
13. Click Documents, click Open, and then click Save.
Results: At the end of this exercise, the Adventure Works Sales workbook will be published on SharePoint.
3. In the Get Data dialog box, click SQL Server database, and then click Connect.
4. In the SQL Server database dialog box, in the Server box, type MIA-SQL.
5. In the Database (optional) box, type AdventureWorksDW, and then click OK.
6. If the Access a SQL Server Database dialog box appears, leave the default settings unchanged, and
then click Connect.
10. On the File menu, click Save, then name the file Adventure Works Sales, and save the file to
D:\Labfiles\Lab01\Starter\Project.
2. Expand DimDate, and drag the EnglishDayNameOfWeek field to the Axis property.
3. Move the chart to the top left-hand corner of the canvas, and expand the chart width so the days of
the week display in full.
7. In the Fields pane, under FactInternetSales, drag the SalesAmount field onto the report canvas to
create a column chart.
8. Under DimDate, drag the CalendarQuarter field onto the chart. Notice that there is only one
column.
9. In the Visualizations pane, click Fields. Drag the CalendarQuarter field from Value to Axis.
13. Expand Data colors, change Show All to on, and for 1, select red, for 2, select blue, and for 3, select
yellow.
14. Move the chart to the right of the Sales by Day of Week chart, and expand it so both charts are the
same height.
15. In the Fields pane, expand DimSalesTerritory, and drag the SalesTerritoryCountry column onto
the report canvas under the Sales by Day of Week chart.
16. Under FactInternetSales, drag the SalesAmount field onto the map.
17. Expand the map to show all the values.
21. In the Fields pane, expand DimCustomer, and drag the CommuteDistance field onto the report
canvas under the Sales by Calendar Quarter chart.
22. Under FactInternetSales, drag the SalesAmount field onto the chart.
Results: At the end of this exercise, you will have a new Power BI Report.
MCT USE ONLY. STUDENT USE PROHIBITED
L1-4 Analyzing Data with Power BI
5. Enter the email address and password for your account, and click Sign in.
6. The report will then be published to the Power BI portal. When the window displays Success, click
Open 'Adventure Works Sales.pbix' in Power BI to view the report online.
7. When the browser opens, if you are prompted to enter your Power BI credentials, enter your email
address and password, and wait for the report to open.
9. In the Pin to dashboard dialog box, click New dashboard, type Adventure Works Sales, and then
click Pin.
10. On the Sales by Calendar Quarter column chart, click Pin visual.
11. In the Pin to dashboard dialog box, click Existing dashboard, in the list click Adventure Works
Sales, and then click Pin.
12. On the Sales by Country map chart, click Pin visual.
13. In the Pin to dashboard dialog box, click Existing dashboard, in the list click Adventure Works
Sales, and then click Pin.
14. On the Sales by Commute Distance donut chart, click Pin visual.
15. In the Pin to dashboard dialog box, click Existing dashboard, in the list click Adventure Works
Sales, and then click Pin.
16. In the upper-left corner of the window, below the Power BI icon, click Show the navigation pane.
4. Type how many customers, and the count of 18484 shows in the results.
6. In the Pin to dashboard dialog box, click Existing dashboard, in the list click Adventure Works
Sales, and then click Pin.
7. Type who is the oldest customer, and the results show the customers ordered by BirthDate.
8. Type how many products are red, and the result is displayed.
9. Type which country has the most male customers, and a bar chart shows the results.
11. In the Pin to dashboard dialog box, click Existing dashboard, in the list click Adventure Works
Sales, and then click Pin.
12. In the Navigation pane on the left-hand side, under Dashboards, click Adventure Works Sales. The
two additional tiles now appear.
Results: At the end of this exercise, you will have published a report to create a dashboard.
MCT USE ONLY. STUDENT USE PROHIBITED
MCT USE ONLY. STUDENT USE PROHIBITED
L2-1
3. In the User Account Control dialog box, click Yes, and then wait for the script to finish.
4. If prompted whether you want to continue the operation, type Y, and then press Enter.
5. When the script completes, press any key to close the window.
6. If you do not have a Power BI login, open Internet Explorer, go to
https://powerbi.microsoft.com/en-us/documentation/powerbi-admin-signing-up-for-power-
bi-with-a-new-office-365-trial, and follow the steps to create an account.
7. In Internet Explorer, go to https://www.microsoft.com/en-us/download/details.aspx?id=45331,
and then click Download.
8. On the Choose the download you want page, select the PBIDesktop_x64.msi check box, and then
click Next.
10. In the Microsoft Power BI Desktop (x64) Setup dialog box, on the Welcome to the Microsoft
Power BI Desktop (x64) Setup Wizard page, click Next.
11. On the Microsoft Software License Terms page, select the I accept the terms in the License
Agreement check box, and then click Next.
13. On the Ready to install Microsoft Power BI Desktop (x64) page, click Install.
15. On the Completed the Microsoft Power BI Desktop (x64) Setup Wizard page, clear the Launch
Microsoft Power BI Desktop check box, and then click Finish.
1. On the Desktop, right-click the Power BI Desktop shortcut, and then click Pin to Taskbar.
2. When the Power BI Desktop window appears, in the left-hand pane, click Get Data.
3. In the Get Data dialog box, click SQL Server database, and then click Connect.
4. In the SQL Server database dialog box, in the Server box type MIA-SQL, in the Database
(optional) box, type AdventureWorks for the database, and then click OK.
MCT USE ONLY. STUDENT USE PROHIBITED
L2-2 Analyzing Data with Power BI
5. In the SQL Server database dialog box, accept the default values, and then click Connect. If an
Encryption Support message is displayed, click OK.
6. In the Navigator dialog box, select the Sales.vSalesPerson check box, and then click Load.
7. In the Fields pane, expand Sales vSalesPerson to view all the columns.
8. On the Home ribbon, click Recent Sources, and then click MIA-SQL: AdventureWorks.
9. In the Navigator dialog box, select the Sales.vStoreWithDemographics check box, and then click
Load.
10. In the Fields pane, expand Sales.vStoreWithDemographics to view all the columns.
11. On the Home ribbon, click Get Data, and then click SQL Server.
12. In the SQL Server database dialog box, in the Server box, type MIA-SQL, and then in the Database
(optional) box, type AdventureWorks.
13. Expand Advanced options, in the SQL statement (optional, required database) box, type the
following code, and then click OK:
14. If the Connection Settings window appears, leave Import checked, and click OK.
15. In the MIA-SQL: AdventureWorks dialog box, click Load.
17. Click the ellipsis (…) next to Query1 and click Rename, type Top 10 Selling Products, and then
press Enter.
2. In the Fields pane, under Sales vSalesPerson, drag the FirstName field to the Axis box in the
Visualizations pane.
3. Drag the SalesYTD field to the Value box. The chart will populate with the data.
4. On the chart in the report, click and drag the sizer on the right-hand side of the chart to widen the
chart and display all the salespeople.
5. Ensure the chart has focus, and then in the Visualizations pane, click Format.
8. Click the report canvas then in the Visualizations pane, click Pie chart to add a control to the report.
Drag the pie chart to the right of the bar chart, or below if there is not enough space.
9. In the Fields pane, under Sales vStoreWithDemographics, drag the Specialty field to the Legend
box in the Visualizations pane.
10. Drag the NumberEmployees field to the Values box. The chart will populate with the data and
should display three pie sections.
MCT USE ONLY. STUDENT USE PROHIBITED
L2-3
11. Click the report canvas, then in the Visualizations pane, click Stacked column chart to add a control
to the report. The chart should be located under the previous charts.
12. In the Fields pane, expand Top 10 Selling Products, drag the Product field to the Axis box in the
Visualizations pane.
13. Drag the LineTotal field to the Value box. The chart will populate with the data.
14. Click the Top 10 Selling Products chart to give it focus, then in the Visualizations pane, click Donut
chart. Note how easy it is to switch to a different chart type.
15. On the chart, grab the sizer on the right-hand side of the donut chart to widen the chart to display all
the product names in full.
16. In the Fields pane, under Sales vStoreWithDemographics, click and drag the AnnualSales field
directly onto the report canvas. See how this automatically creates a bar chart.
17. In the Fields pane, select the AnnualRevenue check box, and note that this adds the field to the bar
chart.
18. In the Fields pane, click the ellipsis (…) next to the AnnualRevenue, and click Rename. Type Annual
Revenue, and then press Enter.
19. Repeat Step 18 to rename the AnnualSales field to Annual Sales. Note that the names in the title
and legend of the bar chart update accordingly.
20. Click the report canvas, and then in the Visualizations pane, click Format.
21. Expand Page Information, and in the Name box, type Sales. Click the report canvas and note the
name has changed in the tab at the bottom of the report.
22. On the File menu, click Save, navigate to D:\Labfiles\Lab02, then create a folder named Power BI.
Name the report Adventure Works Sales, and save in the Power BI folder.
23. Leave Power BI Desktop open on the report for the next task.
3. In the Power BI Desktop window, enter the email address for your Microsoft account, and then click
Sign in.
4. In the Sign in to your account window, enter the password for your Microsoft account, and then
click Sign in.
5. The report will then be published to the Power BI portal. When the window displays Success, click
Open 'Adventure Works Sales.pibx' in Power BI to view the report online.
6. When the browser opens, click Sign in, enter your email address and password, Sign in, and wait for
the report to open in Internet Explorer.
7. Leave the browser window open for the next lab exercise.
Results: After this exercise, a report will be published on the Power BI portal.
MCT USE ONLY. STUDENT USE PROHIBITED
L2-4 Analyzing Data with Power BI
2. In the navigation pane, next to Dashboards, click the Create dashboard icon.
3. Type Adventure Works Sales in the box, and then press Enter.
4. The blank dashboard canvas will appear in the main window.
5. Leave the window open ready for the next lab task.
2. Position the cursor on the SalesYTD by FirstName bar chart, and click Pin Visual.
3. In the Pin to dashboard window, click Existing dashboard and choose Adventure Works Sales in
the list—if these are not already selected—and then click Pin. You will see a notification to say the
visual has been pinned.
4. Position the cursor on the LineTotal by Product bar chart, and click Pin Visual.
5. In the Pin to dashboard window, click Existing dashboard and choose Adventure Works Sales in
the list—if these are not already selected—and then click Pin. You will see a notification to say the
visual has been pinned.
6. Position the cursor on the Annual Sales and Annual Revenue bar chart, and click Pin Visual.
7. In the Pin to dashboard window, click Existing dashboard and choose Adventure Works Sales in
the list—if these are not already selected—and then click Pin. You will see a notification to say the
visual has been pinned.
8. In the navigation pane, under Dashboards, click Adventure Works Sales to open the dashboard.
Leave the dashboard open for the next task.
2. Position the cursor on the SalesYTD chart so the arrow appears in the bottom right-hand corner of
the chart. Grab the arrow and widen the chart so it spans the width of the charts above.
3. With the mouse on the SalesYTD chart, open the menu using the ellipsis in the top right-hand
corner. Click Tile details.
4. In the Tile details pane, in the Title box, change the name to Year to Date Sales.
5. In the Subtitle box, type By Sales Person, and then click Apply.
6. Repeat Steps 3 to 5 for the LineTotal chart. Rename the Title to Top 10 Selling Products. Change
the Subtitle to By Sales.
7. Repeat Steps 3 to 5 for the Annual Sales, Annual Revenue chart. Rename the Title to Annual Sales
v Annual Revenue. Change the Subtitle to By Stores.
MCT USE ONLY. STUDENT USE PROHIBITED
L2-5
8. In the Ask a question about your data box, type best selling sorted by product. When the table
of products appears beneath the question box, click Pin visual.
9. In the Pin to dashboard window, click Existing dashboard and choose Adventure Works Sales in
the list—if these are not already selected—and then click Pin. You will see a notification to say the
visual has been pinned.
10. In the navigation pane, under Dashboards, click Adventure Works Sales. The table of products will
be at the bottom. Drag the table to the top row. Repeat Steps 3 to 5 for the table of products.
Rename the Title to Top 10 Selling Products. Change the Subtitle to By Sales.
11. Leave the dashboard open for the next lab task.
2. Notice the floating menu in the bottom right-hand corner of the screen. Click Fit to Screen and
notice how the screen zooms in to remove as much of the excess background space as possible.
3. Position the cursor on the Year to Date Sales tile so the Open menu ellipsis appears on the top
right-hand corner of the chart. Click the ellipsis, then click Focus mode. The single tile is displayed
and fits the screen.
4. On the floating menu, in the bottom right-hand corner of the screen, click Exit Full Screen Mode.
6. In the Pin to dashboard window, click New dashboard, and enter the name Year to Date Sales, then
click Pin. The Pinned to dashboard pop-up displays to confirm the tile has been pinned.
7. Click Back to Adventure Works Sales in the top left-hand corner of the screen to return to the
dashboard.
Results: After this exercise, a dashboard will be created on the Power BI portal.
MCT USE ONLY. STUDENT USE PROHIBITED
MCT USE ONLY. STUDENT USE PROHIBITED
L3-1
5. Wait until the script completes, and then press any key.
6. If you do not have a Power BI login, open Internet Explorer, browse to
https://powerbi.microsoft.com/en-us/documentation/powerbi-admin-signing-up-for-power-
bi-with-a-new-office-365-trial, and then follow the steps to create an account.
7. In Internet Explorer, browse to https://www.microsoft.com/en-
us/download/details.aspx?id=45331, and then click Download.
8. On the Choose the download you want page, select the PBIDesktop_x64.msi check box, and then
click Next.
10. In the Microsoft Power BI Desktop (x64) Setup dialog box, on the Welcome to the Microsoft
Power BI Desktop (x64) Setup Wizard page, click Next.
11. On the Microsoft Software License Terms page, select the I accept the terms in the License
Agreement check box, and then click Next.
13. On the Ready to install Microsoft Power BI Desktop (x64) page, click Install.
15. On the Completed the Microsoft Power BI Desktop (x64) Setup Wizard page, clear the Launch
Microsoft Power BI Desktop check box, and then click Finish.
17. On the desktop, right-click the Power BI Desktop shortcut, and then click Pin to Taskbar.
2. On the Product Category worksheet, click the ProductCategoryID column header, and then change
the name to Product Category ID in the formula bar.
3. Click the Name column header, and then change the name to Product Category in the formula bar.
MCT USE ONLY. STUDENT USE PROHIBITED
L3-2 Analyzing Data with Power BI
4. Select all rows and columns to highlight cells A1 to B5, in the Cell Styles list, click Normal. The cells
lose their color.
5. Select all rows and columns to highlight cells A1 to B5, and then press CTRL+T.
6. In the Create Table dialog box, ensure that My table has headers is selected, and then click OK. The
cells are transformed into a table.
7. On the Design ribbon, in the Properties group, change the name of the table to ProductCategory.
9. Click the ProductSubcategoryID column header, and then change the name to Product
Subcategory ID in the formula bar.
10. Click the ProductCategoryID column header, and then change the name to Product Category ID in
the formula bar.
11. Click the Name column header, and then change the name to Product Subcategory in the formula
bar.
12. Select all rows and columns to highlight cells A1 to C38, in the Cell Styles list, and then click Normal.
The cells lose their color.
13. Select all rows and columns to highlight cells A1 to C38, and then press CTRL+T.
14. In the Create Table dialog box, ensure that My table has headers is selected, and then click OK. The
cells are transformed into a table.
15. On the Design ribbon, in the Properties group, change the name of the table to
ProductSubcategory.
17. Click the ProductID column header, and then change the name to Product ID in the formula bar.
18. Click the Name column header, and then change the name to Product Name in the formula bar.
19. Click the ProductNumber column header, and then change the name to Product Number in the
formula bar.
20. Click the StandardCost column header, and then change the name to Standard Cost in the formula
bar.
21. Click the ListPrice column header, and then change the name to List Price in the formula bar.
22. Click the ProductSubcategoryID column header, and then change the name to Product
Subcategory ID in the formula bar.
23. Click the ProductModelID column header, and then change the name to Product Model ID in the
formula bar.
24. Select all rows and columns to highlight cells A1 to H505, in the Cell Styles list, and then click
Normal. The cells lose their color.
25. Select all rows and columns to highlight cells A1 to H505, and then press CTRL+T.
26. In the Create Table dialog box, ensure that My table has headers is selected, and then click OK. The
cells are transformed into a table.
27. On the Design ribbon, in the Properties group, change the name of the table to Products.
29. Click the SalesOrderID column header, and then change the name to Sales Order ID in the formula
bar.
30. Click the SalesPerson column header, and then change the name to Sales Person in the formula bar.
31. Click the ProductCategory column header, and then change the name to Product Category in the
formula bar.
32. Click the ProductSubcategory column header, and then change the name to Product Subcategory
in the formula bar.
33. Click the ProductName column header, and then change the name to Product Name in the formula
bar.
34. Click the OrderQty column header, and then change the name to Order Qty in the formula bar.
35. Click the OrderDate column header, and then change the name to Order Date in the formula bar.
36. Click the UnitPrice column header, and then change the name to Unit Price in the formula bar.
37. Click the UnitPriceDiscount column header, and then change the name to Unit Price Discount in
the formula bar.
38. Click the LineTotal column header, and then change the name to Line Total in the formula bar.
39. Click the TotalDue column header, and then change the name to Total Due in the formula bar.
40. Click the Order Date (I) column to select all of the cells, right-click the highlighted cells, and then
click Format Cells.
41. In the Format Cells dialog box, click Date, in the Type list, click *Wednesday, March 14, 2012, and
then click OK.
42. Click to highlight and select all cells in columns J through M, right-click the highlighted cells, and
then click Format Cells.
43. In the Format Cells dialog box, click Currency, in the Symbol list, select $ English (United States),
and then click OK.
44. Select all rows and columns to highlight cells A1 to M60920, in the Cell Styles list, and then click
Normal. The cells lose their color.
45. Select all rows and columns to highlight cells A1 to M60920, and then press CTRL+T.
46. In the Create Table dialog box, ensure that My table has headers is selected, and then click OK. The
cells are transformed into a table.
47. On the Design ribbon, in the Properties group, change the name of the table to Sales.
2. If the Welcome to Power BI page displays, under Files, click Get, and then click Local File.
3. If the main Power BI page displays, in the navigation pane, click Get Data, and then under Files, click
Get, and then click Local File.
4. In the Choose File to Upload dialog box, navigate to the D:\Labfiles\Lab03\Starter\Project folder,
click Adventure Works Data.xlsx, and then click Open.
MCT USE ONLY. STUDENT USE PROHIBITED
L3-4 Analyzing Data with Power BI
5. Click Import to import the Excel data into Power BI. The importing dialog box appears. This might
take a minute or so to load.
6. After loading has completed, click Adventure Works Data from the list of datasets in My
Workspace.
7. In the Fields pane, notice that each of the tabs from Excel have been imported and converted into a
table. Expand each of the tables to view the list of columns. These match the names of the columns in
Excel.
8. Leave Internet Explorer open and remain signed in to Power BI for the next exercise.
Results: After this exercise, the data in Excel will be available as a dataset in Power BI Desktop.
4. If the Power View requires a current version of Silverlight message appears, click Install
Silverlight. Install Silverlight using the default options, and then in Excel, click Reload.
5. In the Power View report, notice the visuals on the report and the Sales Person filter. Close the file.
6. In Internet Explorer, sign in to your Power BI account if you are logged out.
7. In the My Workspace pane, click Get Data.
9. In the Choose File to Upload dialog box, navigate to the D:\Labfiles\Lab03\Starter\Project folder,
click Adventure Works Power View.xlsx, and then click Open.
10. Click Import to import the Excel data into Power BI. The importing dialog box appears. This might
take a minute or so to load.
11. After loading has completed, in My Workspace, in the Reports list, click Adventure Works Power
View.
12. At the bottom of the screen, click Power View Sales to open the report. The Adventure Works Sales
report loads.
14. Position the cursor next to Sales Person(All) so that the Expand arrow appears, and then click the
arrow icon. The list of salespeople appears.
15. Test the report by clicking some of the salespeople, and then check the data changes in the report.
Results: At the end of this exercise, the Power View report will be available as a Power BI report.
MCT USE ONLY. STUDENT USE PROHIBITED
L4-1
4. If a message asks, Do you want to continue with this operation?, type Y and press Enter.
5. Wait for the script to finish, and then press any key when prompted.
6. If you do not have a Power BI login, open Internet Explorer, go to
https://powerbi.microsoft.com/en-us/documentation/powerbi-admin-signing-up-for-power-
bi-with-a-new-office-365-trial, and follow the steps to create an account.
8. On the Choose the download you want page, select the PBIDesktop_x64.msi check box, and then
click Next.
10. In the Microsoft Power BI Desktop (x64) Setup dialog box, on the Welcome to the Microsoft
Power BI Desktop (x64) Setup Wizard page, click Next.
11. On the Microsoft Software License Terms page, select the I accept the terms in the License
Agreement check box, and then click Next.
12. On the Destination Folder page, click Next.
13. On the Ready to install Microsoft Power BI Desktop (x64) page, click Install.
15. On the Completed the Microsoft Power BI Desktop (x64) Setup Wizard page, clear the Launch
Microsoft Power BI Desktop check box, and then click Finish.
3. In the Get Data window, click Excel, and then click Connect.
4. In the Open dialog box, browse to the D:\Labfiles\Lab04\Starter\Project folder, click Sales -
Europe.xlsx, and then click Open.
7. In the Open dialog box, browse to the D:\Labfiles\Lab04\Starter\Project folder, click Sales -
North America.xlsx, and then click Open.
8. In the Navigator window, select North America, and click Edit. This opens the Query Editor window.
9. Leave the Query Editor window open for the next exercise.
5. Right-click the SalesTerritoryGroup column, click Rename, type Sales Territory, and then press
Enter.
6. Right-click the EnglishProductCategoryName column, click Rename, type Main Category, and
then press Enter.
7. Right-click the EnglishProductSubcategoryName column, click Rename, type Sub Category, and
then press Enter.
8. Right-click the EnglishProductName column, click Rename, type Product, and then press Enter.
9. Right-click the Color column, click Move, and then click Left.
10. In the Queries pane, click North America.
14. Right-click the SalesTerritoryGroup column, click Rename, type Sales Territory, and then press
Enter.
15. Right-click the EnglishProductCategoryName column, click Rename, type Main Category, and
then press Enter.
16. Right-click the EnglishProductSubcategoryName column, click Rename, type Sub Category, and
then press Enter.
17. Right-click the EnglishProductName column, click Rename, type Product, and then press Enter.
18. Right-click the Color column, click Move, and then click Left.
19. On the Home tab, in the Query group, click Advanced Editor. Notice that the query includes the
changes you have made, then click Cancel.
20. Leave the Query Editor window open for the next exercise.
Results: At the end of this exercise, the data will be imported from Excel, and shaped ready to be
combined.
MCT USE ONLY. STUDENT USE PROHIBITED
L4-3
3. In the Append dialog box, in the Table to append list, click North America, and then click OK. The
rows are combined.
4. On the Country column header, click the Arrow, and then click Load more. You should now see that
United States and Canada are included. Click Cancel.
5. Using File Explorer, navigate to the D:\Labfiles\Lab04\Starter\Project folder, and open the file
Country Codes.xlsx.
6. Select the rows and columns with data, right-click, and click Copy.
7. In Power BI Desktop, on the Home tab, in the External Data group, click Enter Data.
9. In the Name box, type Country Codes, and then click Load.
11. On the Home tab, in the Combine group, click Merge Queries.
12. In the Merge dialog box, click the Country column to select it.
13. In the list below the table, click Country Codes, click the Country column, and then click OK.
15. In the NewColumn header, click the double-arrow icon, clear the Territory, Country, and Use
original column name as prefix check boxes, and then click OK.
16. Right-click the Code column, point to Move, and click To Beginning.
17. Right-click the Code column, click Rename, type Country Code, and then press Enter.
18. In the Close group, click Close & Apply, and click Apply.
19. Close Query Editor, close Power BI Desktop without saving any changes, and then close Excel.
Results: At the end of this lab, the Europe and North America data will be appended, and the Country
Code column will be added to the query.
MCT USE ONLY. STUDENT USE PROHIBITED
MCT USE ONLY. STUDENT USE PROHIBITED
L5-1
5. Wait for the script to finish, and then press any key.
8. On the Choose the download you want page, select the PBIDesktop_x64.msi check box, and then
click Next.
9. In the message box, click Run.
10. In the Microsoft Power BI Desktop (x64) Setup dialog box, on the Welcome to the Microsoft
Power BI Desktop (x64) Setup Wizard page, click Next.
11. On the Microsoft Software License Terms page, select the I accept the terms in the License
Agreement check box, and then click Next.
15. On the Completed the Microsoft Power BI Desktop (x64) Setup Wizard page, clear the Launch
Microsoft Power BI Desktop check box, and then click Finish.
17. On the Desktop, right-click the Power BI Desktop shortcut, and then click Pin to Taskbar.
3. In the Get Data dialog box, ensure Excel is selected, and click Connect.
4. In the Open dialog box, navigate to D:\Labfiles\Lab05\Starter\Project, click Adventure Works
Sales Data.xlsx, and then click Open.
MCT USE ONLY. STUDENT USE PROHIBITED
L5-2 Analyzing Data with Power BI
10. In the Create Relationships dialog box, in the top table list, click FactInternetSales. When the table
preview appears below, click the OrderDateKey column.
11. In the bottom table list, click DimDate. When the table preview appears below, click the DateKey
column.
12. Check that the Cardinality is selected to Many to One (*:1), the Cross filter direction is Single, and
Make this relationship active is selected, and then click OK.
14. In the diagram, in the FactInternetSales table, click the DueDateKey column. Drag the DueDateKey
column to the DateKey column of the DimDate table.
15. In the diagram, in the FactInternetSales table, click the ShipDateKey column. Drag the
ShipDateKey column to the DateKey column of the DimDate table.
17. In the Manage Relationships dialog box, double-click the FactInternetSales (CurrencyKey)
relationship.
18. In the Cross filter direction list, click Single, and then click OK.
19. In the Manage Relationships dialog box, double-click the FactInternetSales (ProductKey)
relationship.
20. In the Cross filter direction list, click Single, and then click OK.
21. In the Manage Relationships dialog box, double-click the FactInternetSales (PromotionKey)
relationship.
22. In the Cross filter direction list, click Single, and then click OK.
23. In the Manage Relationships dialog box, double-click the FactInternetSales (SalesTerritoryKey)
relationship.
24. In the Cross filter direction list, click Single, and then click OK.
26. Click the relationship line between FactInternetSales and DimCustomer and press Delete.
30. In the top table list, click FactInternetSales. Click the CustomerKey column in the data preview.
31. In the bottom table list, click DimCustomer, and click CustomerKey in the data preview.
32. In the Cardinality list, click Many to One (*:1), and then click OK.
MCT USE ONLY. STUDENT USE PROHIBITED
L5-3
34. Click Save, and save the file to the D:\Labfiles\Lab05\Starter folder as Adventure Works
Sales.pbix.
3. In the Navigator dialog box, select DimProductCategory, and DimProductSubcategory, and then
click Load.
4. In the Relationships pane, look at the relationship that Power BI has created between the two tables.
7. Drag the CategoryKey column in the DimProductSubcategory table to the CategoryKey column in
the DimProductCategory table, to create a Many to One (*:1) relationship, and a Cross filter
direction of Both.
9. Click Save.
10. Leave Power BI Desktop open for the next exercise.
Results: At the end of this exercise, you will have a dataset combining data from two Excel worksheets,
with relationships between the tables.
Exercise 2: Calculations
Task 1: Add a Calculated Column
1. In Power BI Desktop, click Data in the views pane on the left-hand side.
5. Press Enter.
MCT USE ONLY. STUDENT USE PROHIBITED
L5-4 Analyzing Data with Power BI
8. Press Enter.
12. On the Modeling ribbon, in the Calculations group, click New Column.
15. On the Modeling ribbon, in the Calculations group, click New Column.
19. On the Modeling ribbon, in the Calculations group, click New Column.
MainCategory = RELATED(DimProductCategory[CategoryName])
23. On the Modeling ribbon, in the Calculations group, click New Column.
27. On the Modeling ribbon, in the Calculations group, click New Column.
Profit = CURRENCY(FactInternetSales[UnitPrice] -
FactInternetSales[ProductStandardCost])
Results: At the end of this lesson, you will have calculated columns added to the tables in your dataset.
MCT USE ONLY. STUDENT USE PROHIBITED
MCT USE ONLY. STUDENT USE PROHIBITED
L6-1
4. At the command prompt, if prompted, press Y, wait for the script to finish, and then press Enter to
close the command window.
7. On the Choose the download you want page, select the PBIDesktop_x64.msi check box, and then
click Next.
9. In the Microsoft Power BI Desktop (x64) Setup dialog box, on the Welcome to the Microsoft
Power BI Desktop (x64) Setup Wizard page, click Next.
10. On the Microsoft Software License Terms page, select the I accept the terms in the License
Agreement check box, and then click Next.
12. On the Ready to install Microsoft Power BI Desktop (x64) page, click Install.
14. On the Completed the Microsoft Power BI Desktop (x64) Setup Wizard page, clear the Launch
Microsoft Power BI Desktop check box, and then click Finish.
3. In Solution Explorer, expand Queries, and then double-click Lab Exercise 1.sql.
6. In the Get Data dialog box, click Microsoft Azure SQL database, and then click Connect.
MCT USE ONLY. STUDENT USE PROHIBITED
L6-2 Analyzing Data with Power BI
7. In the SQL Server database window, in the Server box, type the URL of the Azure server <Server
Name>.database.windows.net.
10. In SQL Server Management Studio, copy the query under Task 1 in the Lab Exercise 1.sql query.
11. In Power BI Desktop, paste the query into the SQL statement (optional, requires database) box,
and then click OK.
12. If the Access a SQL Server Database window appears, click Database, and then in the Username
box, type Student, and in the Password box, type Pa$$w0rd. Click Connect.
15. In the Get Data dialog box, click Microsoft Azure SQL database, and then click Connect.
16. In the SQL Server database window, in the Server box, type the URL of the Azure server <Server
Name>.database.windows.net.
19. In SQL Server Management Studio, copy the query under Task 2 in the Lab Exercise 1.sql query.
20. In Power BI Desktop, paste the query into the SQL statement (optional, requires database) box,
and then click OK.
23. In the Save As dialog box, navigate to D:\Labfiles\Lab06\Starter, in the File name box, type
AdventureWorksLT Sales.pbix, and then click Save.
24. Leave Power BI Desktop open for the next task.
2. Right-click Query2, click Rename, type Sales, and then press Enter.
5. In the Fields pane, click the Customers table, if it is not already selected.
6. Right-click the NameStyle column, and click Delete.
10. Right-click the CustomerID column, and then click Hide in Report View.
12. On the Modeling ribbon, in the Properties group, click Data Category: Uncategorized, and then
click Address.
MCT USE ONLY. STUDENT USE PROHIBITED
L6-3
14. On the Modeling ribbon, in the Properties group, click Data Category: Uncategorized, and then
click City.
16. On the Modeling ribbon, in the Properties group, click Data Category: Uncategorized, and then
click State or Province.
18. On the Modeling ribbon, in the Properties group, click Data Category: Uncategorized, and then
click Country/Region.
20. On the Modeling ribbon, in the Properties group, click Data Category: Uncategorized, and then
click Postal Code.
21. On the Modeling ribbon, in the Calculations group, click New Column, and then in the formula bar,
type the following expression and press Enter:
FullAddress = Customers[AddressLine1] & ", " & Customers[City] & ", " &
Customers[StateProvince] & ", " & Customers[CountryRegion] & ", " &
Customers[PostalCode]
27. Right-click the CustomerID column, and then click Hide in Report View.
28. Right-click the SalesOrderID column, and then click Hide in Report View.
29. Right-click the SalesOrderDetailID column, and then click Hide in Report View.
30. On the Modeling ribbon, in the Calculations group, click New Column, and then in the formula bar,
type the following expression and press Enter:
32. On the Modeling ribbon, in the Formatting group, click Format: General, point to Currency, and
then click $ English (United States).
33. On the Modeling ribbon, in the Calculations group, click New Measure, and then in the formula
bar, type the following expression and press Enter.
34. Click Save, and then leave Power BI Desktop open for the next task.
MCT USE ONLY. STUDENT USE PROHIBITED
L6-4 Analyzing Data with Power BI
2. In the States worksheet, select all of the values in the two columns, and then press Ctrl+C.
4. In the Create Table dialog box, click in the table, and then press Ctrl+V. Power BI detects that the
first row is a column header.
5. In the Name box, type Sales by State, and then click Load.
6. On the Home ribbon, click Get Data, and then click Web.
8. In the Navigator dialog box, select Codes and abbreviations for U.S. states, territories and other
regions, and then click Load.
9. In the Fields pane, click Codes and abbreviations for U.S. states, territories and other regions to
display the data. The table has 26 rows at the bottom that are not needed.
10. On the Home ribbon, in the External Data group, click Edit Queries, then click Edit Queries.
11. In Query Editor, in the Queries pane, click Codes and abbreviations for U.S. states, territories and
other regions.
12. On the Home ribbon, click Reduce Rows, click Remove Rows, and then click Remove Bottom
Rows.
13. In the Remove Bottom Rows dialog box, in the Number of rows box, type 26, and then click OK.
14. Click the ANSI2 column header, and then hold down the Ctrl key while selecting all of the columns to
the right. This selects multiple rows.
15. Still holding down Ctrl, click the Name and status of region2 and Header columns to include this in
the selection.
16. On the Home ribbon, click Manage Columns, click Remove Columns, and then click Remove
Columns.
17. In the Query Settings pane, under Properties, in the Name box, type States with Codes, and then
press Enter.
18. On the Home ribbon, in the Transform group, click Use First Row as Headers.
19. Right-click the United States of America column header, click Rename, type State Name, and then
press Enter.
20. Right-click the US USA 840 column header, click Rename, type State Code Long, and then press
Enter.
21. Right-click the US column header, click Rename, type State Code Short, and then press Enter.
24. In the Merge dialog box, in the Sales by State table, click the States column.
25. In the list, click States with Codes, click the State Name column, and then click OK. The new column
is added to the table and contains the merged States with Codes table.
MCT USE ONLY. STUDENT USE PROHIBITED
L6-5
26. In the column header, click the Expand icon, clear (Select All Columns), select State Code Short,
and then click OK. The column now shows just the state codes.
27. Right-click the column, click Rename, type State Code, and then press Enter.
29. In the Fields pane, right-click States with Codes, and then click Hide in Report View.
Results: After this exercise, you should have imported data from Azure, shaped it by using the Power BI
transformation tools, and combined the data by merging columns and appending rows.
3. Drag the LineTotal field from the Sales table to the Value property of the gauge.
4. Drag the TargetSales measure from the Sales table to the Target value property of the gauge.
5. Click Format, expand Gauge axis, and then in the Max box, type 146000.
6. Expand Title, in the Title Text box, type Target Sales, and then click Center.
7. Click the report canvas, and then drag the CompanyName field from the Customers table onto the
report. Power BI automatically creates a table.
8. Drag the LineTotal field from the Sales table onto the report.
9. Make sure that the table has focus, and then in the Visualizations pane, click Pie chart.
10. Expand the chart to make all of the company names visible by using the resizer handles on the edge
of the chart.
11. With the focus still on the pie chart, click Format, and then expand Title.
12. In the Title Text box, type Top Selling Customers, and then click Center.
13. Drag the MainCategory field from the Sales table onto the report canvas. Power BI creates a table.
17. Drag the OrderQty field onto the Color saturation property. Notice that the colors change.
18. In the Visualizations pane, click Analytics, expand Constant Line, and then click Add.
20. Change Color to red, toggle Data label to On, and then change the color to red.
22. In the Title Text box, type Orders by Main Category, and then click Center.
23. Click the report canvas to give it focus, and then in the Visualizations pane, click Donut chart.
MCT USE ONLY. STUDENT USE PROHIBITED
L6-6 Analyzing Data with Power BI
25. In the Visualizations pane, click Format, and then expand Title.
26. In the Title Text box, type Sales by Main Category, and then click Center.
27. Drag the Product field from the Sales table onto the report canvas. Power BI creates a table.
28. Drag the LineTotal field from the Sales table onto the products table chart.
36. In the Visualizations pane, click Format, and then expand Title.
37. In the Title Text box, type Top 10 Selling Bikes, and then click Center.
38. In the Visualizations pane, click Analytics, expand Constant Line, and then click Add.
39. In the Value box, type 35000, and then set Color to red.
40. Toggle Data label to On, and then set Color to red.
41. Expand the chart to fill the remaining space on the report canvas. If necessary, move your visuals
around to make them fit.
42. Click Save.
2. In the Fields pane, in the Customers table, select the City field. Power BI adds a map to the report.
3. In the Fields pane, in the Sales table, select the LineTotal field.
4. Using the grabber tool on the right side of the chart, resize the map to show all of the bubbles.
5. Notice that the bubbles are proportionally sized to represent the data.
6. In the Visualizations pane, click Format, and then expand Title.
7. In the Title Text box, type World Sales by City, and then click Center.
8. Click the report canvas, and then in the Sales by State table, select the State Code column. Power BI
automatically adds a map.
10. In the Visualizations pane, click Filled Map. Using the grabber tool on the right side and at the
bottom of the chart, resize the map to show all the states.
12. Position the cursor on California(CA) to see the sales figure. The value has not been formatted as
currency.
MCT USE ONLY. STUDENT USE PROHIBITED
L6-7
14. On the Modeling ribbon, select Format:General, click Currency, and then select $ English (United
Stated).
15. Position the cursor on California(CA) on the map, and notice that the value has been formatted.
16. In the Visualizations pane, click Format, and then expand Title.
17. In the Title Text box, type Sales by State, and then click Center.
18. Click Save, and then leave the report open for the next exercise.
Results: After this exercise, you should have created a report that has chart visuals and is ready to publish
to the Power BI service.
2. In the Sign in to your account dialog box, enter your username (email address) and password, and
then click Sign in.
3. In the Publishing to Power BI dialog box, when the Success label shows, click Open
'AdventureWorksLT Sales.pbix' in Power BI.
4. Internet Explorer will open. If prompted to sign in, enter your username (email address) and
password, and then click Sign in.
3. At the bottom of the page, click Page 1, click the Target Sales visual, and then click Pin visual.
4. In the Pin to dashboard dialog box, click New dashboard, type AdventureWorksLT Sales, and
then click Pin.
6. In the Pin to dashboard dialog box, click Existing dashboard, in the list, click AdventureWorksLT
Sales, and then click Pin.
8. In the Pin to dashboard dialog box, click Existing dashboard, in the list, click AdventureWorksLT
Sales, and then click Pin.
12. In the Pin to dashboard dialog box, click Existing dashboard, in the list, click AdventureWorksLT
Sales, and then click Pin.
13. The dashboard is listed in the My Workspace pane, under Dashboards. Notice the yellow star icon
to denote that this is a new dashboard.
15. Notice that the tiles are all the same size.
16. On the Target Sales tile, click Open menu (…), and then click Tile details.
17. In the Subtitle box, type Sales target for 2016, and then click Apply.
18. On the Top Selling Customers tile, click Open menu (…), and then click Tile details.
19. In the Subtitle box, type Customers selling the most products, and then click Apply.
20. On the Top 10 Selling Bikes tile, click Focus mode. The tile opens into its own space.
21. Expand the Filters pane, expand LineTotal, change the value of 32000 to 40000, and then click
Apply filter.
22. Next to the report title, TOP 10 SELLING BIKES, click the Back to AdventureWorksLT Sales button.
23. Click Enter Full Screen Mode. Notice that the dashboard displays without any of the browser
interface. This is ideal for presentations.
24. Press Esc to exit full-screen mode, and return to the dashboard.
27. Close Power BI Desktop, and then close Excel and SQL Server Management Studio without saving any
changes.
Results: After this exercise, you should have published a report to the Power BI service and used the
visuals to create a dashboard.
MCT USE ONLY. STUDENT USE PROHIBITED
L7-1
5. Wait for the script to complete, and then press any key.
6. If you do not have a Power BI login, open Internet Explorer, browse to
https://powerbi.microsoft.com/en-us/documentation/powerbi-admin-signing-up-for-power-
bi-with-a-new-office-365-trial, and then follow the steps to create an account.
7. In Internet Explorer, browse to https://www.microsoft.com/en-
us/download/details.aspx?id=45331, and then click Download.
8. On the Choose the download you want page, select the PBIDesktop_x64.msi check box, and then
click Next.
10. In the Microsoft Power BI Desktop (x64) Setup dialog box, on the Welcome to the Microsoft
Power BI Desktop (x64) Setup Wizard page, click Next.
11. On the Microsoft Software License Terms page, select the I accept the terms in the License
Agreement check box, and then click Next.
13. On the Ready to install Microsoft Power BI Desktop (x64) page, click Install.
15. On the Completed the Microsoft Power BI Desktop (x64) Setup Wizard page, clear the Launch
Microsoft Power BI Desktop check box, and then click Finish.
17. On the desktop, right-click the Power BI Desktop shortcut, and then click Pin to Taskbar.
4. In the SQL Server database window, in the Server box, type the URL of the Azure server <Server
Name>.database.windows.net (where <Server Name> is the name of the server that you created).
6. Under Data Connectivity mode, click DirectQuery, and then click OK.
7. In the Navigator dialog box, select the SalesLT.Product and SalesLT.SalesOrderDetail tables and
click Load.
9. In the Fields pane, expand the SalesLT SalesOrderDetail table, and drag the OrderQty field to the
chart.
10. Click on the canvas, to ensure that the Card chart is not active.
12. In the Fields pane, expand the SalesLT Product table, and drag the SellStartDate field to the chart.
13. Drag the slider bar to reduce the date range, and verify that the OrderQty value changes.
3. In the Sign in to your account dialog box, enter the credentials you used to sign up for Power BI
service, and then click Sign in.
4. In the Publishing to Power BI dialog box, note the credentials message, and then click Got it; do
not click the link.
Note that, to configure the dataset settings for a DirectQuery data source, you need a Power BI Pro
account.
7. Click Show the navigation pane, and under Reports, click Module07.
10. In the Configure Module07 dialog box, enter the following credentials, and then click Sign in:
11. Click Show the navigation pane, and under Reports, click Module07.
12. In the Module07 report, there is a card visualization for OrderQty and a slicer for SellStartDate.
13. Click Edit report.
14. Click on the canvas to ensure that either of the current visualizations are not active.
Results: At the end of this exercise, data from the AdventureWorks Azure SQL Database will be available
for use in Power BI Desktop and in a desktop report that has been published to the Power BI service.
MCT USE ONLY. STUDENT USE PROHIBITED
MCT USE ONLY. STUDENT USE PROHIBITED
L8-1
5. Wait for the script to complete, and then press any key.
6. If you do not have a Power BI login, open Internet Explorer, browse to
https://powerbi.microsoft.com/en-us/documentation/powerbi-admin-signing-up-for-power-
bi-with-a-new-office-365-trial, and then follow the steps to create an account.
7. In Internet Explorer, browse to https://www.microsoft.com/en-
us/download/details.aspx?id=45331, and then click Download.
8. On the Choose the download you want page, select the PBIDesktop_x64.msi check box, and then
click Next.
10. In the Microsoft Power BI Desktop (x64) Setup dialog box, on the Welcome to the Microsoft
Power BI Desktop (x64) Setup Wizard page, click Next.
11. On the Microsoft Software License Terms page, select the I accept the terms in the License
Agreement check box, and then click Next.
13. On the Ready to install Microsoft Power BI Desktop (x64) page, click Install.
15. On the Completed the Microsoft Power BI Desktop (x64) Setup Wizard page, clear the Launch
Microsoft Power BI Desktop check box, and then click Finish.
17. On the desktop, right-click the Power BI Desktop shortcut, and then click Pin to Taskbar.
2. In the Visuals library section, ensure that Custom visuals is selected, and then browse or search for
Sunburst.
5. At the download prompt, click Save, and download the Sunburst visual to a folder on your local
machine.
6. On the taskbar, click Power BI Desktop.
9. In the Visualizations pane, click the ellipsis (…), and then click Import a custom visual.
10. In the Caution: Import Custom Visual dialog box, click Import.
11. In the Open dialog box, browse to the location where you saved the Sunburst visual, click
Sunburst.x.x.x.pbiviz, and then click Open.
14. In the Visualization pane, click the Sunburst icon. Data that was previously displayed using the
Clustered column chart should now be displayed in the Sunburst visualization.
15. Close Power BI Desktop, without saving any changes, and then close Internet Explorer.
Results: At the end of this exercise, the Sunburst custom visualization will be used in a Power BI report.