Power BI Pro Power BI Premium Power BI Embedded Power BI Report Server Power BI Desktop and ServicePower BI Desktop Getting data Creating a data model Analyzing data Creating and publish
Trang 4Copyright © 2019 Packt Publishing
All rights reserved No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews Every effort has been made in the preparation of this book to ensure the accuracy of the information presented However, the information contained in this book is sold without warranty, either express or implied Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals However, Packt Publishing cannot guarantee the accuracy of this information.
Trang 5Packt.com
Subscribe to our online digital library for full access to over 7,000 books andvideos, as well as industry leading tools to help you plan your personal
development and advance your career For more information, please visit ourwebsite
Trang 6Spend less time learning and more time coding with practical eBooks andVideos from over 4,000 industry professionals
At www.packt.com, you can also read a collection of free technical articles, sign upfor a range of free newsletters, and receive exclusive discounts and offers onPackt books and eBooks
Trang 7Contributors
Trang 8Greg Deckler is Vice President of Cloud Services at Fusion Alliance and has
been a technology systems consultant for over 25 years Internationally
recognized as an expert in Power BI, Greg Deckler is a Microsoft MVP for DataPlatform and an active member of the Power BI community, with over 100,000messages read, more than 11,000 replies, over 2,200 answers, and more than 75entries in the Quick Measures Gallery Greg founded the Columbus Azure MLand Power BI User Group (CAMLPUG) and presents at numerous conferencesand events, including SQL Saturday, DogFood, and Dynamic Communities' UserGroup/Power Platform Summit
I would like to thank the dynamic and vibrant Power BI community as a whole, and especially Charles Sterling, for their dedication and support Also, shout-outs to the following Power BI Community members:
@ImkeF, @konstantinos, @parry2k, @Seth_C_Bauer, @Phil_Seamark, @GilbertQ, @Vvelarde,
@MattAllington @marcorusso, and @Mike_Carlo.
Trang 9Peter Ter Braake started working as a developer in 1996 after studying physics
in Utrecht, the Netherlands Databases and business intelligence piqued his
interest the most, leading to him specializing in SQL Server and its businessintelligence components He worked with Power BI from the tool's very
beginnings
Peter started working as an independent contractor in 2008 This enables him todivide his time between teaching data-related classes, consulting with customers,and writing articles and books
Vishwanath Muzumdar has 6 years' experience in information technology
consulting, business analysis, business development, and business process
management in the business intelligence space He is a Microsoft Power BIdeveloper and creates powerful visual reports for his clients while implementingcorporate Power BI solutions and user training He also has expertise in realizingclient requirements across multiple domains, and proficiently planning and
executing strategies for the same at both an individual and team level He aims
to utilize his strong prioritization skills, analytical ability, and team managementskills, coupled with his expertise in relation to Microsoft Power BI reportingtool, to enable a company to achieve its goals
Trang 10you
If you're interested in becoming an author for Packt, please visit authors.packtpub.c
om and apply today We have worked with thousands of developers and techprofessionals, just like you, to help them share their insight with the global techcommunity You can make a general application, apply for a specific hot topicthat we are recruiting an author for, or submit your own idea
Trang 11Organizing Transforming and cleansing Defining and categorizing Analysis
Visualization The Power BI ecosystem
Core, Power BI-specific Core, non-Power BI-specific Non-core, Power BI-specific Natively integrated Microsoft technologies The extended Power BI ecosystem
Trang 12Power BI Pro Power BI Premium Power BI Embedded Power BI Report Server Power BI Desktop and Service
Power BI Desktop Getting data Creating a data model Analyzing data
Creating and publishing reports Power BI Service
Viewing and editing reports Creating dashboards
Sharing and collaborating with others Accessing and creating apps
Refreshing data Summary
Power BI Desktop (Report Server edition) Running Power BI Desktop
Touring the Desktop
Title Bar and Quick Access Toolbar The Ribbon
The Formula Bar Understanding DAX Views Bar
Panes Canvas Page tabs Footer Generating data
Creating a calculated table
Trang 13Creating your first visualization Formatting your visualization Adding analytics to your visualization Creating and using a slicer
Creating more visualizations Editing visual interactions Summary
Touring the Power Query Editor The Title Bar and Quick Access Toolbar The Ribbon
Formula Bar The Queries Pane The Query Settings Pane Data Canvas
Footer Transforming budget and forecast data Cleaning up extraneous bottom rows Filtering rows
Unpivoting data Using Fill Changing data types Transforming people, tasks, and January data Transforming the People query
Transforming the Tasks query Transforming the January query Merging, copying, and appending queries
Merging queries Expanding tables Disabling the loading of queries Copying queries
Trang 14Organizing queries Checking column quality, distribution, and profiles Loading the data
Views Bar Panes Canvas Layout Tabs Footer Modifying the layout Creating and understanding relationships Exploring the data model
Creating calculations
Calculated columns Understanding context for calculated columns Creating calculated columns for utilization Measures
Understanding context for measures Creating measures for utilization Checking and troubleshooting calculations
Boundary cases Slicing
Grouping Summary
Trang 15Testing roles Using report navigation features
Drillthrough Using drillthrough Buttons
Types of buttons Button states Button actions Question and answer (Q&A) Best practices for Q&A Using a Q&A button Using Q&A in report authoring Synonyms
Bookmarks Creating and using bookmarks Advanced bookmarks
Advanced visualization techniques
Top N filtering Gauges and KPIs What-if parameters Conditional formatting Quick Measures
Report page Tooltips Creating Report page Tooltips Using Report page Tooltips Key influencers
Using a theme Creating a page template Syncing the slicers Adjusting the calendar Adding report filters Creating the final report pages
Trang 16Creating the Branch Management page Creating the Hours Detail page Creating the Employee Details page Creating the Introduction page Finishing up
Testing Cleaning up Summary
Touring the Service Header
Navigation Pane Canvas
Publishing and sharing
Creating a workspace Publishing
What happens when you publish? Sharing
Personal bookmarks Persistent filters Subscribing
Trang 17Copying Printing Export to PowerPoint Export to PDF
Download report Embedding reports
Secure embed codes Using URL parameters with embed codes Using the pageName parameter Using the filter parameter SharePoint Online
Publish to web Managing publish to web embed codes Editing and creating reports
Editing a report Creating a Mobile Layout Creating a report
Set as featured Phone view Ellipses menu Dashboard themes Q&A
Working with tiles Sizing and position Ellipsis menu Understanding apps
Creating an app Getting and using apps Understanding security and permissions
Workspace permissions App permissions Object permissions
Trang 18Dataset permissions RLS
Personal mode Standard mode Configuring a data gateway Service Settings Diagnostics Network Connectors Managing a data gateway Gateway cluster settings and administrators Removing a gateway and adding data sources Refreshing datasets
Scheduling a refresh Summary
Questions
Further reading
Other Books You May Enjoy
Trang 19To succeed in today's transforming business world, organizations need business
intelligence (BI) capabilities to make smarter decisions faster than ever before.
This Power BI book is an entry-level guide that will get you up and running withdata modeling, visualization, and analytical techniques from scratch
You'll find this book handy if you want to become well-versed with the extensiveecosystem of Power BI You'll start by covering the basics of BI and installingPower BI You'll then learn about the wide range of Power BI features to unlockbusiness insights As you progress, the book will take you through how to usePower Query to ingest, cleanse, and shape your data, and use Power BI DAX tocreate simple to complex calculations You'll also be able to add a variety ofinteractive visualizations to your reports in order to bring your data to life
Finally, you'll gain hands-on experience in creating visually stunning reports thatspeak to business decision makers, and see how you can securely share thesereports and collaborate with others
By the end of this book, you'll be ready to create simple, yet effective, BI reportsand dashboards using the latest features of Power BI
Trang 20If you're an IT manager, data analyst, or BI user who is new to using Power BIfor solving BI problems, then this book is for you You'll also find this bookuseful if you want to migrate from other BI tools to create powerful and
interactive dashboards Note that no experience of working with Power BI isrequired in order to proceed
Trang 21Chapter 1, Introduction to Business Intelligence and Power BI, provides an
overview of all of the various components that encompass the Power BI
ecosystem, including Power BI Desktop, Power BI Service, Power BI Licensing,Power BI Premium, data gateways, Power BI Report Server, integrations withother Microsoft technologies (such as Office 365, Flow, Visio, and PowerApps),third-party products (such as visuals, and connectors), the Power BI Community,and, if there is room, other Microsoft and third-party websites
Chapter 2, Up and Running with Power BI Desktop, shows how to download and
install the Power BI Desktop In addition to this, an overview of the major
components and interfaces of the Desktop is presented This includes the Report,Data, and Model panes; the menu tabs; and the Filters, Visualizations, and Fieldspanes Finally, we are introduced to the creation of data tables and the creation ofvisualizations
Chapter 3, Connecting and Shaping Data, serves as an introduction to the Query
Editor to import and transform data, including transposing data, creating customcolumns, adding index columns, splitting columns, referencing queries,
appending and merging queries, and other transformation functions In addition
to this, you will learn how to create data models using the relationship editor
Chapter 4, Creating Data Models and Calculations, shows us how to add
additional data to our model and create calculated measures You will use thedata and measures to create more advanced visuals, as well as explore your data
to understand the important information it contains You will also use the Q&Afeature and more advanced features to unlock insights
Chapter 5, Unlocking Insights, teaches us how to tell a story with our data by
using more advanced features, such as Bookmarks, the Selection pane, Buttons,Drillthrough, and report page tooltips In addition to this, you will learn about
"What if" parameters and much more
Chapter 6, Creating the Final Report, demonstrates how to use formatting and
other features of Power BI to take a mundane looking report and add flash, pop,
Trang 22more advanced features of the Service, including how to use workspaces tocollaborate with others, how to publish their combined work as an app, and how
to find and use other apps
Chapter 10, Data Gateways and Refreshing Datasets, returns to the subject of data
by exploring how to use and manage datasets and workbooks in the Service Inaddition to this, this chapter introduces the subject of Data Gateways to assistusers in keeping their on-premises data sources up to date Finally, you will beintroduced to dataflows
Trang 23A keen interest in solving BI problems will be handy Some prior experience ofusing other BI tools is also a bonus
Trang 24You can download the example code files for this book from your account at www packt.com If you purchased this book elsewhere, you can visit www.packtpub.com/suppo
We also have other code bundles from our rich catalog of books and videos
available at https://github.com/PacktPublishing/ Check them out!
Trang 25We also provide a PDF file that has color images of the screenshots/diagramsused in this book You can download it here: http://www.packtpub.com/sites/default/fi les/downloads/9781838644482_ColorImages.pdf
Trang 26There are a number of text conventions used throughout this book
CodeInText: Indicates code words in text, database table names, folder names,filenames, file extensions, pathnames, dummy URLs, user input, and Twitterhandles Here is an example: "Download LearnPowerBI.pbix and the Budget and
Forecast.xlsx, People and Tasks.xlsx, and Hours.xlsx files from GitHub."
Warnings or important notes appear like this.
Tips and tricks appear like this.
Trang 28Please leave a review Once you have read and used this book, why not leave areview on the site that you purchased it from? Potential readers can then see anduse your unbiased opinion to make purchase decisions, we at Packt can
understand what you think about our products, and our authors can see yourfeedback on their book Thank you!
For more information about Packt, please visit packt.com
Trang 29The objective of this section is to introduce you to key concepts, examplescenarios, and downloading supporting data of Power BI
This section comprises of the following chapter:
Chapter 1, Introduction to Business Intelligence and Power BI
Trang 30Introduction to Business Intelligence and Power BI
Power BI is a powerful ecosystem of business intelligence tools and technologies
from Microsoft But what exactly is business intelligence, anyway? Simply
stated, business intelligence is all about leveraging data in order to make better
decisions This can take many forms and is not necessarily restricted to justbusiness We use data in our personal lives to make better decisions as well Forexample, if we are remodeling a bathroom, we get multiple quotes from differentfirms The prices and details in these quotes are pieces of data that allow us tomake an informed decision in terms of which company to choose We may alsoresearch these firms online This is more data that ultimately supports our
decision
In this chapter, we will explore the key fundamental concepts of business
intelligence, as well as why business intelligence is important to organizations
In addition, we take a high-level tour of the Power BI ecosystem, licensing, andcore tools such as the Power BI Desktop and the Power BI Service
Trang 31Business intelligence, in the context of organizations, revolves around making
better decisions about your business Unlike the example in the introduction,
organizations are not generally concerned with bathrooms, but rather with whatcan make their business more effective, efficient, and profitable The businesses
While business intelligence is a vast subject in and of itself, the key concepts ofbusiness intelligence can be broken down into five areas:
Trang 32A domain is simply the context within which business intelligence is applied.
Most businesses are comprised of relatively standard business functions ordepartments, such as the following:
The domain helps in narrowing down the focus regarding which questions can
be answered and what decisions need to be made For example, within the
context of sales, a business might want to know which sales personnel are
performing better and which sales personnel are performing worse Businessintelligence can provide this insight as well as help determine which activitiesenable certain sales professionals to outperform others This information canthen be used to train and mentor sales personnel who are performing morepoorly
Within the context of marketing, a business can use business intelligence todetermine which types of marketing campaigns, such as email, radio, print, TV,and the web, are most effective in attracting new customers This then informsthe business where they should spend their marketing budget
Within the context of manufacturing, a business can use business intelligence to
determine the mean time between failure (MTBF) for machines that are used
in the production of goods This information can be used by the business to
Trang 33Clearly, there are endless examples of where business intelligence can make anorganization more efficient, effective, and profitable Deciding on a domain inwhich to employ business intelligence techniques is a key step in enabling
business intelligence undertakings within organizations since the domain dictateswhich key questions can be answered, the possible benefits, as well as whichdata is required in order to answer those questions
Trang 34Once a domain has been decided upon, the next step is identifying and acquiringthe data that's pertinent to that domain This means identifying the sources ofrelevant data These sources may be internal or external to an organization andmay be structured, unstructured, or semi-structured in nature
Trang 35Internal data is data that's generated within an organization by its business
processes and operations These business processes can generate large volumes
of data that is specific to that organization's operations This data can take theform of net revenues, sales to customers, new customer acquisitions, employeeturnover, units produced, cost of raw materials, and much more time series ortransactional information This historical and current data is valuable to
organizations if they wish to identify patterns and trends, as well as for
forecasting and future planning Importantly, all the relevant data to a domainand question are almost never housed within a single data source; organizationsinevitably have multiple sources of relevant data
In addition to internal data, business intelligence is most effective when internaldata is combined with external data Crucially, external data is data that is
generated outside of the boundaries of an organization's operations Such
external data includes things such as the business's overall global economicperformance, census information, and competitor prices All of this data existsirrespective of any particular organization
Each domain and question will have internal and external data that is relevantand irrelevant to answering the question at hand However, do not be fooled intobelieving that simply because you have chosen manufacturing/production as thedomain that other domains such as sales and marketing do not have relevantsources of data If you are trying to forecast the required production levels, salesdata in terms of pipelines can be very relevant Similarly, external data thatpoints toward overall economic growth may also be extremely relevant whiledata such as the cost of raw materials may very well be irrelevant
Trang 36structured data
Structured, unstructured, and semi-Structured data is data that conforms to a rather formal specification of tableswith rows and columns Think of a spreadsheet where you might have columnsfor the transaction ID, customer, units purchased, and price per unit Each rowrepresents a sales transaction Structured data sources are the easiest sources forbusiness intelligence tools to consume and analyze These sources are most oftenrelational databases, which include technologies such as Microsoft SQL Server,Microsoft Access, Azure Table storage, Azure SQL database, Oracle, MySQL,IBM DB2, Teradata, PostgreSQL, Informix, and Sybase In addition, this
category of data sources includes relational database standards and APIs such as
Open Database Connectivity (ODBC) and Object Linking and Embedding Database (OLE DB).
Unstructured data is effectively the opposite of structured data Unstructureddata cannot be organized into simple tables with rows and columns Such dataincludes things such as videos, audio, images, and text Word processing
documents, emails, social media posts, and web pages are also examples oflargely unstructured data Unstructured data sources are the most difficult types
of sources for business intelligence tools to consume and analyze This type ofdata is either stored as binary large objects (BLOBS) or as a file in a filesystem
such as the New Technology File System (NTFS) or the Hadoop Distributed
File System (HDFS).
Unstructured data also includes so-called NoSQL databases, which include datastores such as document databases, graph databases, and key-value stores Thesedatabases are specifically designed to store unstructured data Document
databases include Microsoft Azure Cosmos DB, MongoDB, 10Gen, Cloudant(IBM), Couchbase, and MarkLogic Graph databases include Neo4j and
HyperGraphDB Key-value stores include Microsoft's Cosmos DB, Basho
Technologies' Riak, Redis, Aerospike, Amazon Web Services' DynamoDB,Basho Technologies, Couchbase, Datastax's Cassandra, MapR Technologies, andOracle Finally, wide-column stores include Cassandra and HBase
Trang 37definition of structured data, that is, tables with rows and columns Examples ofsemi-structured include tab and delimited text files, XML, other markup
The vast majority of business intelligence tools, such as Power BI, are optimizedfor handling structured and semi-structured data Structured data sources
integrate natively with how business intelligence tools are designed In addition,business intelligence tools are designed to ingest semi-structured data sourcesand transform them into structured data Unstructured data is more difficult butnot impossible to analyze with business intelligence tools In fact, Power BI has
a number of features that are designed to ease the ingestion and analysis of
unstructured data sources However, analyzing such unstructured data has itslimitations
Trang 38A model, or data model, refers to the way in which one or more data sources are
organized in order to support analysis and visualization Models are built bytransforming and cleansing data, helping to define the types of data within thosesources, as well as the definition of data categories for specific data types
Trang 39Models can be extremely simple, such as a single table with columns and rows.However, business intelligence almost always involves multiple tables of data,and most often involves multiple tables of data coming from multiple sources.Thus, the model becomes more complex as the various sources and tables of datamust be combined into a cohesive whole This is done by defining how each ofthe disparate sources of data relates to one another As an example, let's say youhave one data source that represents a customer's name, contact information, andperhaps size in revenue and/or the number of employees This information might
come from an organization's customer relationship management (CRM)
system The second source of data might be order information, which includesthe customer's name, units purchased, and the price that was paid This second
source of data comes from the organization's enterprise resource planning (ERP) system These two sources of data can be related to one another based on
the name of the customer
Some sources of data have prebuilt models This includes traditional data
warehouse technologies for structured data as well as analogous systems forperforming analytics over unstructured data The traditional data warehouse
technology is generally built upon the online analytical processing (OLAP) technology and includes systems such as Microsoft's SQL Server Analysis
Services (SSAS), Azure Analysis Services, Snowflake, Oracle's Essbase,
AtScale cubes, SAP HANA and Business Warehouse servers, and Azure SQLData Warehouse With respect to unstructured data analysis, technologies such asApache Spark, Databricks, and Azure Data Lake Storage are used
Trang 40When building a data model, it is often (read always) necessary to clean and
transform the source data Data is never clean—it must always be massaged in
order for bad data to be removed or resolved For example, when dealing withcustomer data from a CRM system, it is not uncommon to have the same
customer entered into the system with multiple spellings The format of data inspreadsheets may make data entry easy for humans but can be unsuitable forbusiness intelligence purposes In addition, data may have errors, missing data,inconsistent formatting, or even have something as seemingly simple as trailingspaces All of these types of situations can cause problems when performingbusiness intelligence analysis Luckily, business intelligence tools such as Power
BI provide mechanisms for cleansing and reshaping the data to support analysis.This might involve replacing or removing errors in the data, pivoting,
unpivoting, or transposing rows and columns, removing trailing spaces, or othertypes of transformation operations
Transforming and cleansing technologies are often referred to as extract,
transform, load (ETL) tools and include products such as Microsoft's SQL Server Integration Services (SSIS), Azure Data Factory, Alteryx, Informatica,
Dell Boomi, Salesforce's Mulesoft, Skyvia, IBM's Infosphere Information
Server, Oracle Data Integrator, Talend, Pentaho Data Integration, SAS's DataIntegration Studio, Sybase ETL, and QlikView Expressor