Pro Power
Bl Desktop
Interactive data analysis and visualization for the desktop Second Edition
Adam Aspin
Trang 2Pro Power BI Desktop
Adam Aspin
Trang 3Pro Power BI Desktop Adam Aspin Stoke-on-Trent, Staffordshire, United Kingdom ISBN-13 (pbk): 978-1-4842-3209-5 ISBN-13 (electronic): 978-1-4842-3210-1 https://doi.org/10.1007/978-1-4842-3210-1
Library of Congress Control Number: 2017962307 Copyright © 2018 by Adam Aspin
This work is subject to copyright All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed
Trademarked names, logos, and images may appear in this book Rather than use a trademark symbol with every occurrence ofa trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made The publisher makes no warranty, express or implied, with respect to the material
contained herein
Cover image designed by Freepik
Managing Director: Welmoed Spahr
Editorial Director: Todd Green Acquisitions Editor: Jonathan Gennick
Development Editor: Laura Berendson Technical Reviewer: Chad Schuessler
Coordinating Editor: Jill Balzano
Copy Editor: Bill McManus Compositor: SPi Global
Indexer: SPi Global Artist: SPi Global
Distributed to the book trade worldwide by Springer Science+Business Media New York,
233 Spring Street, 6th Floor, New York, NY 10013 Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail
orders-ny@springer-sbm com, or visit www springeronline.com Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc)
SSBM Finance Inc is a Delaware corporation
For information on translations, please e-mail rights@apress com, or visit http: //www.apress.com/ rights-permissions
Apress titles may be purchased in bulk for academic, corporate, or promotional use eBook versions
and licenses are also available for most titles For more information, reference our Print and eBook Bulk Sales web page at http: //www.apress.com/bulk-sales
Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the book's product page, located at www apress com/9781484232095 For more detailed information, please visit http: //www.apress.com/source-code
Trang 5Contents
About te Aufl0r .ceceseseseeesesseiennsnssnnsrnsnsssrsse XỈX About the Technical ReVieWer .e‹eesseseseseseessennsnssssrsssesss XXXL Acknowledgments XXxxili
InnfroduCfÏOI eeeseseseseesesesisresrnnnnnssnssnsnsnsrssnsnsrs XÖOXV Chapter 1: Introduction to Power BI Desktop
The Microsoft Self-Service Business Intelligence Solutio
Importing Data from Diverse Sources Modeling Your Data Creating Reports and Dashboards Power BI Desktop Files
The Power Bl UNiVErSe .cesseesseesseessessesssesssesssesssesssesssesssesssesssesssesssesssessstssseesneesseesneenes 4 Installing Power BI Desktop
Removing Power BI Desktop
Running Power BI Desktop
A First Power BI Desktop DaShb0ard c.csssssssssesesessestsessssestssesessssissssissesisessiseeenseeees 10
Loading the Source Data
The Data Load Process ccsssessssssssssseesssesseesssessesseesseesseesseesseesseesseesseessessseesseesseesseesneesy 14
Trang 6CONTENTS Your First Visualizations Displaying Available Fields Adding a Matrix of Sales per Country by Year Adding a Column Chart of Delivery Charge by Model Adding a Map of Labor Cost by Country Adding a Card Showing the Total Cost of Spare Parts
Adding a Slicer by Make
Trang 7CONTENTS Text ANd CSV OPtionS ssssssssssesssssssnssseesesssssssnssessssessssssnsssesssssssssnssssseessssssnsssseessesssssnnssesseessssnnnnsseseees 48 XML FICS ssscsssssssssssscccsssssssssessesesssssnsssseseessssssnsssseesesssssnussseceessssssssssessessssssnnssseessessssnnnsseseeessssnnnnssseess 49 Excel Files Importing Excel and Power View Item Microsoft Access Databases JSON Files
Loading Multiple Files from a Directory .cccscssessssessssectssestsseetsseetsseetsseeesseetsseeesseeees 56 Loading the Contents Of @ Folder .ccsscscssessssessssesessessssestsseetsseetsseesseetsseetsseeesseeesseeees 59 The Navigator Dialog
Searching for Datasets Display Options ccecssscssssescsssesssssesessssesesssseesssseeesssseeessnseeessssesessnneeesssneeessnueeessnneeesssneeessnneeessnneeesey R@fF@SÌN - HH nà nến Hàn Hàn Hà Hư Hà HA Hà HH TH Hàng nàng ni ni Adding Your 0wn Data Conclusion Chapter 3: Loading Data from Databases and Data Warehouses Relational Databases SQL Server Automatically Loading Related Tables tre 71 Database Options Searching for Tables Oracle Databases
Other Relational Da†abas6s .¿- ¿5:2 thay 85 Microsoft SQL Server Analysis Services Da†a S0UC@S . . 55+ 86
Analysis Services Cube TOOIS .sssesssssesesssseeessssecsssseesssseeesssneesssneesssneeessneeessneeessneeessnneeessnieessnee 89
Trang 8CONTENTS
Refreshing Data from Databases and Data Warehouses
Refreshing the Entire Data in the Power BI Desktop In-Memory Model
Refreshing an Individual Table ssssssssssssssessestisstsseeeististtssisstistintineeseeististineeneeneeee 109
Conclusion
Chapter 4: DirectQuery and Connect Live
DirectQuery and Connect LiVE c.ccescssesesseseesssesseseesssesssstesssssssssesssssesssessesesseseseees Microsoft SQL SerVer Dafa - ¿5c sàn nàn Hà nàn niàt SQL Server Analysis Services Dimensional Data
Microsoft SQL Server Analysis Services Tabular Data Sources
DirectQuery with Non-Microsoft Databases
Trang 9CONTENTS
Azure SQL Data Warehouse
Connecting to SQL Server on an Azure Virtual Machine Azure Blob Storage Azure Security Conclusion c sasasansnae Í ĐẾ) 160
IfChapter 6: Dealing with Datasets Power BI Desktop Queries
Editing Data After a Data Load
Transforming Data Before Loading Query or Load? The Power BI Desktop Query Editor
The Applied Steps List
Trang 10CONTENTS
Filtering NUMETrIC RANGES .ssesssssseesssssessssssessssssecesssseessssseessssseeessnseeessuseesssusessssniesessnseesssneeessaneeeseey 186 Filtering Date and Time Ranges sssssessssssessssssessssssecsssssesssssseesssnsesesssseesssnseesssnsesessnseesssneessaneeessan 187 Filtering Data Applying Advanced Filters .sssssssssssssesesstisttssessestististisstististississeietististiseeieeistett 190 GrOUPING RECOFS cssessssssessesessesecseseessseessstesssessssesssstssssessssssassessssessesessesessesesaeensaees 191 SÏITpll@ GT0UDS - 6£ s2 SE TH HH HH HH1 H111 1111111111111 Complex Groups
Saving Changes in the Query EqitOF c.cessceceseeesessesesssstessstssesssssessseesseessessseseseees 195 Exiting †he Query EdφOf - «+ + St E11 110111101111 111111111 rrrey 195 OIICÏUSÏOHI 552522 23223213221301110 11 TH Hy Hà Hà Hà Hà Hà Hà Hà Hàn iệt 196
Viewing a Full Record 198 Power BI Desktop Query Editor Context Menus 199 Using the First Row AS Headers .c.ssscsssssssssessssessssessssessssesssstssssssssssssssssessssessesnsaees 200 Changing Data Type cesccssssssssessessssssessssssssseessseesssessssessssessssissssesssssassessssessssesseenseess
Detecting Data Types
Data Type Indicator: Switching Data Types
Data Type Using LOCaI@ ssssessssssessssssessssssecsssssessssssecessssessssssesessnseeesssueesssnsessssniesessnsessssneeessaneeeseay 204
Replacing Values .c.scsssssssessssesessssessssesssseessseesssessssessssesassesssssessessssessssessseesseeesaesnsaees 205 Transforming Column Cofn†@fnÏS - <6 St $v‡xvE‡xvEvexeEkekerkekrrkekrrkekerkee 207
Text Transformation
Adding a Prefix or a Suffix
Removing Leading and TrailiIg S4G@S + +££++++e£vS++veevExvveertxxterrtktsrrrtkkerrrrtie 209 Removing Non-Printing CliaFaG†@fS ¿se 5++teEEY+xeEEExkxerkkktrrtkkkrrttkkkrrirkrrrrrttie 209
Number TraIìSÍOFITIAfÏOINS - 2c c2 se +x£E£EEx#EE+xEEELEEEAEEELkEELSEEELkEELkritkrrtttrrttrrrtkrrtiee 210
Filling Down Ermp†y ÖellS ¿- - St + St£k+xvEexEEkexeEtexeEtekrrkerrrkekrkererkrke 217 Extracting Part of a Coluimnn”s C0rI†@I†S 5c c5 +*x‡xvEekekkekrrketrrkererske 219
Advanced ExtraC† O†ÍOIIS - 6£ St SE E111 T111 E111 111xerrrrriree 220