Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Microsoft Power BI Cookbook
Microsoft Power BI Cookbook

Microsoft Power BI Cookbook: Convert raw data into business insights with updated techniques, use cases, and best practices , Third Edition

Arrow left icon
Profile Icon Greg Deckler Profile Icon Powell
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.7 (23 Ratings)
Paperback Jul 2024 598 pages 3rd Edition
eBook
€8.99 €35.99
Paperback
€44.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Greg Deckler Profile Icon Powell
Arrow right icon
€18.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.7 (23 Ratings)
Paperback Jul 2024 598 pages 3rd Edition
eBook
€8.99 €35.99
Paperback
€44.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€8.99 €35.99
Paperback
€44.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Microsoft Power BI Cookbook

Accessing, Retrieving, and Transforming Data

Power BI Desktop and dataflows in the Power BI service contain a rich set of connectors and transformation capabilities that support the integration and enhancement of data from many different sources. These features are all driven by a powerful functional language and query engine, M, which leverages source system resources when possible and can greatly extend the scope and robustness of the data retrieval process beyond what’s possible via the standard query editor interface alone. As with almost all BI projects, the design and development of the data access and retrieval process have significant implications for the analytical value, scalability, and sustainability of the overall Power BI solution.

In this chapter, we dive into both Power BI Desktop’s Get Data experience and the equivalent process with dataflows in the Power BI service in establishing and managing data source connections and queries. Although these...

Technical Requirements

The following are required to complete the recipes in this chapter:

  • Power BI Desktop.
  • SQL Server 2022 or newer with the AdventureWorksDW2022 database installed. See the Installing SQL Server and the AdventureWorks Database and Installing and Configuring Power BI Desktop sections in Chapter 1, Installing and Licensing Power BI Tools.

Importing Data

The output of Power Query (M) queries can either be loaded (imported) as compressed in-memory local tables or can merely define source tables for a data source to use via a DirectQuery connection. The import storage mode is the default and preferred option for most scenarios, as this delivers the best possible performance while also providing greater modeling flexibility, with more DAX functions supported and easier integration of distinct sources. Import is the default storage mode for Power BI Desktop. The collection of imported tables and DirectQuery tables is referred to as a semantic model.

Import semantic models created in Power BI Desktop use the same in-memory, columnar-compressed storage engine (VertiPaq) featured in Analysis Services’ Tabular import models. Import mode models support the integration of disparate data sources (for example, SQL Server and DB2) and allow more flexibility in developing metrics and row-level security roles, via...

Using DirectQuery

One of the most valuable features of Power BI is its deep support for real-time and streaming semantic models, with the ability to provide immediate visibility to business processes and events as this data is created or updated. As Power BI has become Microsoft’s flagship semantic modeling tool, with exclusive features not available in Azure Analysis Services or SQL Server Analysis Services, it has become feasible to design both DirectQuery models and composite models which utilize a mixture of DirectQuery and import storage modes on a per table basis.

The three most common candidates for DirectQuery or composite model projects are as follows:

  • The data model would consume an exorbitant amount of memory if all tables were fully loaded into memory. Even if the memory size is technically supported by large Power BI Premium capacity nodes, this would be a very inefficient and expensive use of company resources, as most BI queries only access aggregated...

Creating Dataflows

Power BI dataflows are a feature within the Microsoft Power BI service that allows users to transform and combine data from various sources, perform data transformation and cleansing operations, and then store the results in inexpensive Azure Blob Gen2 Storage.

Dataflows also use the Power Query M language and are constructed using a web-based version of Power Query Editor. In effect, dataflows are cloud-based versions of queries that you would otherwise create in Power BI Desktop.

Getting ready

To prepare for this recipe, you will need a Power BI Pro license or trial license. See the Thinking about Licensing recipe from Chapter 1, Installing and Licensing Power BI Tools. Create a new workspace in the Power BI service. This workspace should be a Pro workspace and not a Fabric or Fabric trial workspace. Fabric workspaces include the Dataflows Gen2 capabilities, which are constructed almost identically to dataflows.

In addition, you should complete...

Applying Filters

The application of precise and often complex filter conditions has always been at the heart of business intelligence, and Power BI Desktop supports rich filtering capabilities across its query, data model, and visualization components. In many scenarios, filtering at the query level via Power Query Editor and M functions is the optimal choice, as this reduces the workload of both Import and DirectQuery data models and eliminates the need to re-apply the same filter logic across multiple reports or visualizations.

Although Power Query Editor’s graphical interface can be used to configure filtering conditions, this recipe demonstrates M’s core filtering functions and the use of M in common multi-condition filter scenarios. The M expression queries constructed in this recipe are intended to highlight some of the most common filtering use cases.

Note that applying data transformations as part of a data warehouse ETL or ELT (extract-load-transform...

Transforming and Cleansing Data

The transformations applied within Power BI’s M queries serve to protect the integrity of the data model and to support enhanced analysis and visualization. The specific transformations vary based on data quality, integration needs, and the goals of the overall solution. At a minimum, developers should seek to protect the integrity of the model’s relationships and simplify the user experience via denormalization and standardization. Additionally, developers should converse with the owners of data sources to determine if required transformations can be implemented in the source or made available via SQL view objects.

This recipe demonstrates how to protect a model from duplicate values within the source data that can prevent the formation of proper relationships within the data model, which may even result in query failures. While a simple scenario is used, this recipe demonstrates scenarios you may run into while attempting to merge...

Creating Custom Columns

Business users often extend the outputs of existing reports and data models with additional columns to help them analyze and present data. The logic of these columns is generally implemented through Excel formulas or as calculated DAX columns. A superior solution, particularly if the logic cannot be migrated to a data warehouse or IT resource, is to create the columns via Power Query Editor and the M language.

Developing custom columns can also significantly enhance the ease of use and analytical power of data models and the visualizations they support. In this recipe, columns are created to apply a custom naming format and simplify the analysis of a customer dimension via existing columns.

Getting ready

To get ready for this recipe, import the DimCustomer table from the AdventureWorksDW2022 database by doing the following:

  1. Open Power BI Desktop and choose Transform data from the ribbon of the Home tab to open Power Query Editor.
  2. ...

Combining and Merging Queries

The full power of Power BI’s querying capabilities is in the integration of distinct queries representing different data sources, via its merge and append transformations. Retrieval processes that consolidate files from multiple network locations or integrate data from multiple data sources can be developed efficiently and securely. Additionally, the same join types and data transformation patterns that SQL and ETL developers are familiar with can be achieved with the M language. This recipe provides examples of combining sources into a single query and leveraging the table join functions of M to support common transformation scenarios.

Getting ready

To follow along with this recipe, you can use the Merge Queries and Append Queries icons on the Home tab of Power Query Editor to generate the join expressions used in this recipe. However, as joining queries is fundamental to the retrieval process, it is recommended to learn how to use the...

Profiling Source Data

Well before any semantic models and reports are developed, and especially before business stakeholders begin consuming the content to derive insights, it’s a good practice to assess and validate the quality of the source data. Data quality profiling exercises can reveal the presence of various issues, ranging from null or blank values in certain columns to duplicate rows, to the lack of unique or identifying (primary key) columns. The findings from this exercise inform decisions on whether the source system data itself can be cleansed or whether the BI solution will address these issues, via the various Power Query (M) data cleansing functions available.

The topic of data quality deals with the overall utility of semantic models, as well as the ability to easily process and use the data for certain purposes, including analytics and reporting. Data quality is an essential component of data governance, ensuring that business data is accurate, complete...

Diagnosing Queries

The Power Query M engine is an extremely powerful and fast data transformation and data preparation engine used across an array of products, including:

  • Excel for Windows
  • Excel for Mac
  • Power BI
  • Power Apps
  • Power Automate
  • ADF
  • SSIS
  • SQL Server Analysis Services
  • Dynamics 365 Customer Insights

While both fast and powerful, there are times when you may find that a particular query is not as performant as desired. In these instances, Query Diagnostics can help you pinpoint problematic expressions and better understand what Power Query is doing in order to identify areas for query optimization. This recipe demonstrates how a user can use Query Diagnostics to troubleshoot a query and identify how the query might be optimized to be more performant.

Getting ready

To get ready, import the FactCurrencyRate table from the AdventureWorksDW2022 database by doing the following:

  1. Open Power BI Desktop...

Extending the Core M Library

The core M library comes with hundreds of different functions to aid in data connectivity, data cleansing, and data transformation. However, one of the strengths of the M language is its ability to be easily extended with custom functions.

In this recipe, we add a simple custom function as an extension of the core M library of functions.

Getting ready

To prepare for this recipe, we first need to identify and/or create a Custom Connections folder for Power BI Desktop. Look in your Documents directory for the current user. If the folder Microsoft Power BI Desktop does not exist, create it. Navigate to the Microsoft Power BI Desktop folder, and if the folder Custom Connectors does not exist, create it.

How to extend the core M library

To implement this recipe, follow these steps:

  1. Create the following text file and save the file as Cookbook3.pq in the [Documents]\Microsoft Power BI Desktop\Custom Connectors folder.
    /...

Summary

The ability to ingest and access data is crucial to every BI project. In Power BI, this data ingest and access is driven by a powerful functional language and query engine, M. The Power Query M language provides a robust, scalable, and flexible engine for data retrieval, cleansing, and transformation.

In this chapter, we dove into Power BI Desktop’s data transformation experience and walked through the process of establishing and managing data source connections and queries. We explored both import and DirectQuery storage modes, as well as creating reuseable queries within the Power BI Service called dataflows. We then demonstrated powerful data transformation techniques, including filtering and cleansing data, creating custom columns, and combining and merging multiple queries. Finally, we demonstrated how to profile data, diagnose non-performant queries, and how to extend the core M library of functions.

In the next chapter, we leverage the knowledge gleaned...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Dive into Microsoft Data Fabric for deeper insights and robust data strategies
  • Implement Hybrid tables, create comprehensive scorecards, and establish shared cloud connections effortlessly
  • Uncover new and updated data visualization tools that turn complex data into clear, actionable charts and reports
  • Purchase of the print or Kindle book includes a free eBook in PDF format

Description

Since its first edition the Power BI Cookbook has been a best-selling resource for BI developers and data analysts to produce impactful, quality BI solutions. This new and updated edition retains the rigorous details and concepts readers of prior editions have enjoyed while also demonstrating powerful new capabilities and updated guidance aligned to the current state of the platform. In this book, with step-by-step instructions, you will learn to navigate the complexities of data integration and visualization in Power BI. From creating robust data models to implementing sophisticated reporting techniques, this Power BI book empowers you to make informed decisions based on actionable insights. It also introduces you to new capabilities such as Hybrid tables and scorecards, enhancing your ability to communicate and analyze business performance. It also expands and improvises on the core of the previous edition like parameterizing Power BI solutions, authoring reports, data intelligence, and integrating advanced analytics. This edition not only updates you on the latest features but also prepares you for future innovations with a preview of upcoming AI enhancements in Power BI. Whether you're refining your skills or aspiring to become an expert, this book is an invaluable resource for leveraging Power BI to its fullest potential

Who is this book for?

This book is designed for data analysts, business intelligence professionals, and anyone involved in data processing or analytics who seeks to enhance their skills with Power BI’s latest features and prepare for future advancements in the field

What you will learn

  • Analyze and integrate business data using Microsoft Data Fabric
  • Create impactful visualizations and manage Hybrid tables
  • Develop shared cloud connections and advanced scorecards
  • Enhance report accuracy and dynamics using real-time data processing
  • Implement efficient data governance and security measures within Power BI

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jul 31, 2024
Length: 598 pages
Edition : 3rd
Language : English
ISBN-13 : 9781835464274
Category :
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Jul 31, 2024
Length: 598 pages
Edition : 3rd
Language : English
ISBN-13 : 9781835464274
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 120.97
Microsoft Power BI Cookbook
€44.99
Extending Power BI with Python and R
€41.99
Microsoft Power BI Performance Best Practices
€33.99
Total 120.97 Stars icon
Banner background image

Table of Contents

15 Chapters
Installing and Licensing Power BI Tools Chevron down icon Chevron up icon
Accessing, Retrieving, and Transforming Data Chevron down icon Chevron up icon
Building a Power BI Semantic Model Chevron down icon Chevron up icon
Authoring Power BI Reports Chevron down icon Chevron up icon
Working in the Power BI Service Chevron down icon Chevron up icon
Getting Serious About Date Intelligence Chevron down icon Chevron up icon
Parameterizing Power BI Solutions Chevron down icon Chevron up icon
Implementing Dynamic User-Based Visibility in Power BI Chevron down icon Chevron up icon
Applying Advanced Analytics and Custom Visuals Chevron down icon Chevron up icon
Enhancing and Optimizing Existing Power BI Solutions Chevron down icon Chevron up icon
Deploying and Distributing Power BI Content Chevron down icon Chevron up icon
Integrating Power BI with Other Applications Chevron down icon Chevron up icon
Working with Premium and Microsoft Fabric Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.7
(23 Ratings)
5 star 87%
4 star 8.7%
3 star 0%
2 star 0%
1 star 4.3%
Filter icon Filter
Top Reviews

Filter reviews by




P. Laws Sep 03, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I'm largely self-taught on Power BI but this is a great book to really kick off right the way - all the way through from installing the software and other supporting tools like Report Builder, building a model and report and then improving and documenting it.Each chapter is very well laid out in a clear format - I like the structure with "Getting ready", "How it works" and "There's more" in nice bitesize chunks with each chapter closing out with a good Summary.There are links to GitHub so you can do the doing which works really well.There are some great modelling techniques in this book for both the beginner and more advanced user.Definitely another great addition to the bookshelf with nice colour screenshots, well laid out as with other Packt books I've read and does a great job of getting the technical aspects articulated clearly.
Amazon Verified review Amazon
Devaraj Oct 02, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book covers essential aspects such as data connectivity, modeling, visualization, and advanced analytics. It delves into the Power Query (M) language for data transformation, DAX measures for business intelligence, and the importance of creating well-structured semantic models to optimize performance and reporting.Additionally, it highlights the use of real-time data processing,RLS for data access control, and integration with external applications, making it a valuable resource for enhancing Power BI knowledge and skills.Key InsightsUnderstanding DAX and M languages is crucial for advanced data transformation and analysis in Fabric.Semantic models should be well-structured to ensure optimal performance and support diverse reporting needs.Real-time data capabilities in Power BI enhance decision-making processes and provide timely insights.Implementing RLS ensures that users access only relevant data, enhancing data security and compliance.
Amazon Verified review Amazon
Federico Pastor Sep 02, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is an excellent guide for enhancing your Power BI skills, offering a comprehensive collection of practical recipes to tackle real-world business intelligence challenges.The content is well-organized, taking you from the basics to advanced topics such as data modeling and DAX for complex data analysis. Each chapter focuses on specific functionalities or tasks, making it easy for readers to find relevant information and apply best practices.The cookbook-style instructions are straightforward and easy to follow, allowing users to apply the steps directly to their projects. The real-life examples provided illustrate how to effectively utilize Power BI features to simplify and improve your work.With the latest edition incorporating all new features and enhancements, this book provides valuable tips on how to excel at analysing any type of data using Power BI visuals and functions. Highly recommended for anyone looking to deepen their understanding of Power BI.And guess what? It’s in colour! So you won’t just learn a lot—you’ll have a colourful time doing it. 🌈
Amazon Verified review Amazon
James W Sep 01, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Wow this book is great and full colour too, every page I flick to I see something interesting to dig into full of great inspiration and insightful tips
Amazon Verified review Amazon
Thomas Rice Sep 25, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I'll be clear and brief: this is a great Power BI cookbook! I've read a handful of Power BI books over the years and I think this is one of the best ones to date. It covers everything from licensing to getting started with Microsoft fabric. With more than 550 pages across 13 chapters, you will walk away with a deep understanding of Power BI best practices. Easy to read, follow, and understand too!
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.