Explore fundamentals of data visualization with Power BI
In this exercise you’ll use Microsoft Power BI Desktop to create a data model and a report containing interactive data visualizations.
This lab will take approximately 20 minutes to complete.
Install Power BI Desktop
If Microsoft Power BI Desktop is not already installed on your Windows computer, you can download and install it for free.
- Download the Power BI Desktop installer from https://aka.ms/power-bi-desktop.
- When the file has downloaded, open it, and use the setup wizard to install Power BI Desktop on your computer. This installation may take a few minutes.
Import data
-
Open Power BI Desktop. The application interface should look similar to this:
Now you’re ready to import the data for your report.
-
On the Power BI Desktop welcome screen, select Get data, and then in the list of data sources, select Web and then select Connect.
-
In the From web dialog box, enter the following URL and then select OK:
https://github.com/MicrosoftLearning/DP-900T00A-Azure-Data-Fundamentals/raw/master/power-bi/customers.csv
-
In the Access Web content dialog, select Connect.
-
Verify that the URL opens a dataset containing customer data, as shown below. Then select Load to load the data into the data model for your report.
-
In the main Power BI Desktop window, in the Data menu, select Get data, then select Web:
-
In the From web dialog box, enter the following URL and then select OK:
https://github.com/MicrosoftLearning/DP-900T00A-Azure-Data-Fundamentals/raw/master/power-bi/products.csv
-
In the dialog, select Load to load the product data in this file into the data model.
-
Repeat the previous three steps to import a third dataset containing order data from the following URL:
https://github.com/MicrosoftLearning/DP-900T00A-Azure-Data-Fundamentals/raw/master/power-bi/orders.csv
Explore a data model
The three tables of data you’ve imported have been loaded into a data model, which you’ll now explore and refine.
-
In Power BI Desktop, on the left-side edge, select the Model tab, and then arrange the tables in the model so you can see them. You can hide the panes on the right side by using the » icons:
-
In the orders table, select the Revenue field and then in the Properties pane, set its Format property to Currency:
This step will ensure that revenue values are displayed as currency in report visualizations.
-
In the products table, right-click the Category field (or open its ⋮ menu) and select Create hierarchy. This step creates a hierarchy named Category Hierarchy. You may need to expand or scroll in the products table to see this - you can also see it in the Fields pane:
- In the products table, right-click the ProductName field (or open its ⋮ menu) and select Add to hierarchy > Category Hierarchy. This adds the ProductName field to the hierarchy you created previously.
-
In the Fields pane, right-click Category Hierarchy (or open its … menu) and select Rename. Then rename the hierarchy to Categorized Product.
- On the left-side edge, select the Table view tab, and then in the Data pane, select the customers table.
-
Select the City column header, and then set its Data Category property to City:
This step will ensure that the values in this column are interpreted as city names, which can be useful if you intend to include map visualizations.
Create a report
Now you’re almost ready to create a report. First you need to check some settings to ensure all visualizations are enabled.
-
On the File menu, select Options and Settings. Then select Options, and in the Security section, ensure that Use Map and Filled Map visuals is enabled and select OK.
This setting ensures that you can include map visualizations in reports.
-
On the left-side edge, select the Report view tab and view the report design interface.
-
In the ribbon, above the report design surface, select Text Box and add a text box containing the text Sales Report to the report. Format the text to make it bold with a font size of 32.
-
Select any empty area on the report to de-select the text box. Then in the Data pane, expand Products and select the Categorized Products field. This step adds a table to the report.
-
With the table still selected, in the Data pane, expand Orders and select Revenue. A Revenue column is added to the table. You may need to expand the size of the table to see it.
The revenue is formatted as currency, as you specified in the model. However, you didn’t specify the number of decimal places, so the values include fractional amounts. It won’t matter for the visualizations you’re going to create, but you could go back to the Model or Data tab and change the decimal places if you wish.
-
With the table still selected, in the Visualizations pane, select the Stacked column chart visualization. The table is changed to a column chart showing revenue by category.
-
Above the selected column chart, select the ↓ icon to turn on drill-down. Then in the chart, select the second column to drill down and see the revenue for the individual products in this category. This capability is possible because you defined a hierarchy of categories and products.
- Use the ↑ icon to drill back up to the category level. Then select the (↓) icon to turn off the drill-down feature.
- Select a blank area of the report, and then in the Data pane, select the Quantity field in the orders table and the Category field in the products table. This step results in another column chart showing sales quantity by product category.
-
With the new column chart selected, in the Visualizations pane, select Pie chart and then resize the chart and position it next to the revenue by category column chart.
-
Select a blank area of the report, and then in the Data pane, select the City field in the customers table and then select the Revenue field in the orders table. This results in a map showing sales revenue by city. Rearrange and resize the visualizations as needed:
-
In the map, note that you can drag, double-click, use a mouse-wheel, or pinch and drag on a touch screen to interact. Then select a specific city, and note that the other visualizations in the report are modified to highlight the data for the selected city.
- On the File menu, select Save. Then save the file with an appropriate .pbix file name. You can open the file and explore data modeling and visualization further at your leisure.
If you’ve a Power BI service subscription, you can sign into your account and publish the report to a Power BI workspace.