Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Microsoft Power BI Quick Start Guide - Third Edition

You're reading from  Microsoft Power BI Quick Start Guide - Third Edition

Product type Book
Published in Nov 2022
Publisher Packt
ISBN-13 9781804613498
Pages 330 pages
Edition 3rd Edition
Languages
Authors (4):
Devin Knight Devin Knight
Profile icon Devin Knight
Erin Ostrowsky Erin Ostrowsky
Profile icon Erin Ostrowsky
Mitchell Pearson Mitchell Pearson
Profile icon Mitchell Pearson
Bradley Schacht Bradley Schacht
Profile icon Bradley Schacht
View More author details

Table of Contents (13) Chapters

Preface 1. Gaining Data Literacy with Power BI 2. Connecting to Data 3. Data Transformation Strategies 4. Building the Data Model 5. Leveraging DAX 6. Visualizing Data 7. Digital Storytelling with Power BI 8. Using a Cloud Deployment with the Power BI Service 9. Data Cleansing in the Cloud with Dataflows 10. On-Premises Solutions with Power BI Report Server 11. Other Books You May Enjoy
12. Index

Data Transformation Strategies

Within any business intelligence (BI) project, it is essential that the data you are working with has been properly scrubbed to ensure accurate results on your reports and dashboards. Applying data cleansing business rules, also known as transformations, is the primary method for correcting inaccurate or malformed data, but the process can often be the most time-consuming part of any corporate BI solution. However, the data transformation capabilities built into Power BI are both very powerful and user-friendly. Using the Power Query Editor, tasks that would typically be difficult or time-consuming in an enterprise BI tool are as simple as right-clicking on a column and selecting the appropriate transform for the field. While interacting with the user interface, the Power Query Editor automatically writes queries using a language called M behind the scenes.

Through the course of this chapter, you will explore some of the most common features of the...

Which should I choose?

Now that you have learned about the three different ways to connect to your data, you are left wondering which option is best for you. It's fair to say that the choice you make will really depend on the requirements of each individual project you have.

To summarize, some of the considerations that were mentioned in this chapter are listed in the following table:

Consideration Import Data DirectQuery Live connection
Best performance Yes No Yes
Best design experience Yes No No
Best for keeping data up to date No Yes Yes
Data source availability Yes No No
Most scalable No Yes Yes

Some of the items you'll consider may be more important than others. So, to make this more personal, try using the Data Connectivity - Decision Matrix file that is included with this book. In this file, you can rank (from 1 to 10) the importance of each of these considerations to help you choose which option is best for you.

Since the Import Data option presents the...

Summary

Often Power BI developers have questions concerning various data sources and what unique challenges come with each connection. The great news is once you have established a connection to your data source, regardless of which one it is, everything after that point typically follows that same pattern of steps. The point is don’t let any one data source overly intimidate you. Once you connection to it, the rest of your Power BI solution design will follow the same processes mentioned earlier in this chapter of data discovery, data modeling, data visualization, and sharing.

Power BI provides users with a variety of methods for connecting to data sources with natively built-in data connectors. The connector you choose for your solution will depend on where your data is located. Once you've connected to a data source, you can decide on what type of query mode best suits your needs. Some connectors allow for little to no latency in your results with options like DirectQuery...

Advanced data transformation options

Now that you should be more comfortable working within the Power Query Editor, let’s take the next step and discuss more advanced options. Often, you will find the need to go beyond these basic transforms when dealing with data that requires more care. In this section, you will learn about some common advanced transforms that you may have a need for, which include Conditional Columns, Fill Down, Unpivot, Merge Queries, and Append Queries.

Add Conditional Columns

Using the Power Query Editor Conditional Columns functionality is a great way to add new columns to your query that follow logical if/then/else statements. This concept of if/then/else is common across many programming languages, including Excel formulas. Let’s review a real-world scenario where you would be required to do some data cleansing on a file before it could be used. In this example, you will be provided with a file of all the counties in the United States...

The R programming language

R is a very powerful scripting language that is primarily used for advanced analytics tools but also has several integration points within Power BI. One such integration is the ability to apply business rules to your data with the R language.

Why is that important? Well, with this capability, you can extend beyond the limits of the Power Query Editor and call functions and libraries from R to do things that would not normally be possible. In the next two sections, you will explore how to set up your machine to leverage R within Power BI and then walk through an example of using an R script transform.

There are many additional books and references you can read to learn more about the R scripting language, but for the purposes of this book, our goal is to inform you of what is possible when R and Power BI are combined.

Installation and configuration

To use R within Power BI, you must first install an R distribution for you to run...

AI Insights

As you learned in the previous section, Power BI integrates and takes advantage of outside tools to enhance the capabilities within itself. That continues to be the case with the AI Insights features. Leveraging the AI Insights capabilities gives you the ability to tap into core features and algorithms within Azure Cognitive Services and expose them within Power BI. So how can this be useful to you?

Imagine you work for a company that runs a vacation rentals website. Customers can book trips and post reviews of them on your website. With thousands of customers and hundreds of rental homes, it can be difficult to manage all the reviews that come in to make sure your locations are all meeting the standards your customers expect. With AI Insights you can run algorithms that can perform sentiment analysis, key phrase extraction, language detection, and even image tagging.

So, if you have international customers that post reviews, you can use language detection to understand...

The M formula language

The Power Query Editor is the user interface that is used to design and build data imports. However, you should also know that every transform you apply within this editor is actually, quietly and behind the scenes, writing an M query for you. The letter M here is a reference to the language’s data mash-up capabilities.

For simple solutions, it is unlikely that you will ever need to even look at the M query that is being written, but there are some more complex cases where it’s helpful to understand how to read and write your own M. For the purposes of this book, covering just the Power BI essentials, you will learn how to find the M query editor within your solution and then understand how to read what it is doing for you.

For the purposes of this example, you can open up any previously built example; however, the screenshot used here is from the very first example in this chapter on basic transforms:

  1. Using any Power BI solution...

Summary

In this chapter, you learned that the Power Query Editor is an extremely powerful tool for applying business rules to incoming data. Implementing data cleansing techniques can be as simple as right-clicking on a column, or more complex, such as when building a conditional column. While the Power Query Editor does have a vast library of transforms available, you also learned that you can tap into the capabilities of R to extend what’s possible when designing queries. Finally, this chapter discussed the AI capabilities within the Power Query Editor that allow you to leverage several algorithms available within Azure Cognitive Services. In the next chapter on building the data model, you will learn about proper techniques for developing a well-designed Power BI data model to ensure your solutions can solve all your reporting needs.

Join our community on Discord

Join our community’s Discord space for discussions with the authors and other readers:

...
lock icon The rest of the chapter is locked
You have been reading a chapter from
Microsoft Power BI Quick Start Guide - Third Edition
Published in: Nov 2022 Publisher: Packt ISBN-13: 9781804613498
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}