Data is at the heart of Power BI. In this Guided Learning section, you learn how to get and work with data in Power BI.
You will learn how to...
Welcome to the second section in this Guided Learning course for Power BI, called Getting Data. This section looks at the many data-centric features and tools of Power BI, focusing on Power BI Desktop. Many of these tools also apply to the Power BI service, so you're doing double duty with your learning in this section.
When you get data, sometimes it's not quite as well-formed, or clean, as you want it to be. So in this section you learn how to get data, how to clean it up (sometimes called cleaning or transforming data), and also learn some advanced tricks that can make your data-getting life easier.
As always in this course, your learning journey follows the same path as the flow of work in Power BI. As such, let's check out Power BI Desktop, where it often begins.
An overview of Power BI Desktop
Power BI Desktop is a tool to connect to, clean, and visualize your data. With Power BI Desktop, you can connect to data and then model and visualize it in different ways. Most users who are working on Business Intelligence projects will spend the majority of their time using Power BI Desktop.
You can download Power BI Desktop from the web, you can also install Power BI Desktop as an app from the Windows Store, or you can download it from the Power BI service. In the service, to get Power BI Desktop you just select the down arrow button in the upper right side of Power BI, then select Power BI Desktop.
Power BI Desktop installs as an application on your Windows computer.
So once you download it, you'll install Power BI Desktop and run it like other applications on Windows. The following image shows the Start Screen of Power BI Desktop, which appears when you start the application.
Power BI Desktop connects to a wide variety of data sources, from local on-premises databases to Excel worksheets to cloud services. It helps you clean and format your data to make it more usable, including splitting and renaming columns, changing data types, and working with dates. You can also create relationships between columns so that it's easier to model and analyze your data.
In this topic, we take a closer look at how the first two parts of Power BI fit together:
- Create a report in Power BI Desktop
- Publish the report in the Power BI service
We’ll start in Power BI Desktop, and select Get Data. The collection of data sources appears, allowing you to choose a data source. The following image shows selecting a Web page as the source, in the video above, Will selected an Excel workbook.
Regardless of which data source you choose, Power BI connects to that data source, and shows you the data available from that source. The following image is another example, this one is from a Web page that analyzes different states and some interesting retirement statistics.
In Power BI Desktop Report view, you can begin to build reports.
The Report view has five main areas:
- The ribbon, which displays common tasks associated with reports and visualizations
- The Report view, or canvas, where visualizations are created and arranged
- The Pages tab area along the bottom, which lets you select or add a report page
- The Visualizations pane, where you can change visualizations, customize colors or axes, apply filters, drag fields, and more
- The Fields pane, where query elements and filters can be dragged onto the Report view, or dragged to the Filters area of the Visualizations pane
The Visualizations and Fields pane can be collapsed by selecting the small arrow along the edge, providing more space in the Report view to build cool visualizations. When modifying visualizations, you'll also see these arrows pointing up or down, which means you can expand or collapse that section, accordingly.
To create a visualization, just drag a field from the Fields list onto the Report view. In this case, let’s drag the State field from RetirementStats, and see what happens.
Look at that... Power BI Desktop automatically created a map-based visualization, because it recognized that the State field contained geolocation data.
Now let’s fast-forward a bit, and after creating a report with a few visualizations, we’re ready to publish this to the Power BI service. On the Home ribbon in Power BI Desktop, select Publish.
You’ll be prompted to sign in to Power BI.
When you've signed in and the publish process is complete, you see the following dialog. You can select the link (below Success!) to be taken to the Power BI service, where you can see the report you just published.
When you sign in to Power BI, you'll see Power BI Desktop file you just published in the service. In the image below, the report created in Power BI Desktop is shown in the Reports section.
In that report, I can choose the Pin icon to pin that visual to a dashboard. The following image shows the pin icon highlighted with a bright box and arrow.
When I select that, the following dialog appears, letting me pin the visual to an existing dashboard, or to create a new dashboard.
When we pin a couple of visuals from our report, we can see them in the dashboard.
There’s a lot more you can do with Power BI, of course, such as sharing the dashboards you create. We'll discuss sharing later on in this course.
Next, we look at a feature that can automatically create dashboards for you, just by connecting to a cloud service like Facebook, Salesforce, and many others.
Power BI Desktop can connect to a whole range of data sources, including on-premises databases, Excel workbooks, and cloud services. Currently, over 59 different cloud services such as GitHub and Marketo have specific connectors, and you can connect to generic sources through XML, CSV, text, and ODBC. Power BI will even scrape tabular data directly from a website URL! But let's start from the beginning, with opening Power BI Desktop and connecting to data.
When you start Power BI Desktop and move past the Start Screen, you can choose Get Data from the ribbon on the Home tab.
There are monthly updates to Power BI Desktop, and with each update, the Power BI Desktop What's New page gets updated with information about the updates, links to the blog, and a download link.
In Power BI Desktop, there are all sorts of different data sources available. Select a source to establish a connection. Depending on your selection, you will be asked to find the source on your computer or network, or be prompted to log in to a service to authenticate your request.
After connecting, the first window you'll see is the Navigator. The Navigator displays the tables or entities of your data source, and clicking on one gives you a preview of its contents. You can then import your selected tables or entities immediately, or select Edit to transform and clean your data before importing.
Once you've selected the tables you'd like to bring into Power BI Desktop, you can choose to load them into Power BI Desktop by selecting the Load button in the bottom right corner of Navigator. There are times, however, where you might want to make changes to those tables before you load them into Power BI Desktop. You might want only a subset of customers, or filter that data for sales that occurred only in a specific country. In those cases, you can select the Edit button and filter or transform that data before bringing it all into Power BI Desktop.
We'll pick up there, and edit our data, in the next section.
Power BI Desktop includes Query Editor, a powerful tool for shaping and transforming data so it's ready for your models and visualizations. When you select Edit from Navigator, Query Editor launches and is populated with the tables or other entities you selected from your data source.
You can also launch Query Editor directly from Power BI Desktop, using the Edit Queries button on the Home ribbon.
Once Query Editor is loaded with data that's ready for you to shape, you see a handful of sections:
- In the ribbon, many buttons are now active to interact with the data in the query
- In the left pane, queries (one for each table, or entity) are listed and available for selection, viewing, and shaping
- In the center pane, data from the selected query is displayed and available for shaping
- The Query Settings window appears, listing the query’s properties and applied steps
In the center pane, right-clicking on a column displays a number of different available transformations, such as removing the column from the table, duplicating the column under a new name, and replacing values. From this menu you can also split text columns into multiples by common delimiters.
The Query Editor ribbon contains additional tools, such as changing the data type of columns, adding scientific notation, or extracting elements from dates, such as day of the week.
As you apply transformations, each step appears in the Applied Steps list in the Query Settings pane on the right side of Query Editor. You can use this list to undo or review specific changes, or even change the name of a step. To save your transformations, select Close & Apply on the Home tab.
Once you select Close & Apply, Query Editor applies the query changes you made, and applies them to Power BI Desktop.
There are all sorts of things you can do when transforming data in Query Editor, including advanced transformations. In the next section, we take a look at a few of those advanced transformations, to give you a sense of the almost immeasurable ways you can transform your data with Query Editor.
In this article, we investigate some advanced data import and cleaning techniques for Power BI Desktop. Once you've shaped your data in Query Editor and brought it into Power BI Desktop, you can look at it in a few different ways. There are three views in Power BI Desktop: Report view, Data view, and Relationships view. You see each view by selecting its icon in the upper left side of the canvas. In the following image, Report view is selected. The yellow bar beside the icon indicates which view is active.
To change the view, just select either of other two icons. The yellow bar beside the icon indicates which view is active.
Power BI Desktop can combine data from multiple sources into a single report, at any time during the modelling process. To add additional sources to an existing report, select Edit Queries in the Home ribbon and then select New Source in Query Editor.
There are many different possible data sources you can use in Power BI Desktop, including Folders. By connecting to a folder, you can import data from multiple files at once, such as a series of Excel files of CSV files. The files contained within your selected folder appear in Query Editor as binary content, and clicking the double-arrow icon at the top of the Content column loads their values.
One of Power BI's most useful tools is its Filters. For example, selecting the drop-down arrow next to a column opens a checklist of text filters that you can use to remove values from your model.
You can also merge and append queries, and turn multiple tables (or data from various files, in folders) into a single table that contains just the data you want. You can use the Append Queries tool to add the data from a new table to an existing query. Power BI Desktop attempt to match up the columns in your queries, which you can then adjust as necessary in Query Editor.
Finally, the Add Custom Column tool gives advanced users the option of writing query expressions from scratch using the powerful M language. You can add a custom column based on M query language statements, and get your data just the way you want it.
While Power BI can import your data from almost any source, its visualization and modeling tools work best with columnar data. Sometimes your data will not be formatted in simple columns, which is often the case with Excel spreadsheets, where a table layout that looks good to the human eye is not necessarily optimal for automated queries. For example, the following spreadsheet has headers that span multiple columns.
Fortunately, Power BI has tools to quickly transform multi-column tables into datasets that you can use.
For example, using Transpose in Query Editor, you can flip data (turn columns to rows, and rows into columns) so you can break data down into formats that you can manipulate.
Once you do that a few times, as described in the video, your table begins to shape into something that Power BI can more easily work with.
You also may need to format data, so Power BI can properly categorize and identify that data once it's imported.
With a handful of transformations, including promoting rows into headers into to break headers, using Fill to turn null values into the values found above or below in a given column, and Unpivot Columns, you can cleanse that data into a dataset that you can use in Power BI.
With Power BI, you can experiment with these transformations on your data, and determine which types get your data into the columnar format that lets Power BI work with it. And remember, all actions you take are recorded in the Applied Steps section of Query Editor, so if a transformation doesn't work the way you intended, you can simply click the x next to the step, and undo it.
Once your data is in a format that Power BI can use, by transforming and cleansing the data, you can begin to create visuals.
Congratulations! You've completed this section of the Guided Learning course for Power BI. You now know how to get data into Power BI Desktop, and how to shape or transform that data, so you can create compelling visuals.
The next step in learning how Power BI works, and how to make it work for you, is to understand what goes into modeling. As you learned, a dataset is a basic building block of Power BI, but some datasets can be complex and based on many different sources of data. And sometimes, you need to add your own special touch (or field) to the dataset you create.
You'll learn about modeling, and a whole lot more, in the next section. See you there!
Way to go! You've completed the Getting data section of Microsoft Power BI Guided Learning. The next step is to learn about Modeling, which is the subject of the next tutorial.
You learned how to...
- Overview of Power BI Desktop
- Getting started with Power BI Desktop
- Connect to data sources in Power BI Desktop
- Clean and transform your data with the Query Editor
- More advanced data sources and transformation
- Cleaning irregularly formatted data