Creating Your First Report

Một phần của tài liệu Applied microsoft power bi Bring your data to life (Trang 104 - 107)

In Chapter 2, you imported the Internet Sales Excel file in Power BI. As a result, Power BI created a dataset with the same name. Let’s analyze the sales data by creating the report shown in Figure 3.20. This report consists of two pages. The Summary page has six visualizations and the Treemap page (not shown in Figure 3.20) uses a Treemap visualization to help you analyze sales by product at a glance. (For an example of a Treemap visualization skip ahead to Figure 3.22.)

Getting started with report authoring

One way to create a new report in Power BI is to explore a dataset.

1.In the Power BI portal, click the Internet Sales dataset to create a new report that is connected to this dataset. Alternatively, you can click the ellipsis (…) next to the dataset in the left navigation pane, and then click Explore.

2.Power BI opens a blank report in Editing View. Click the Text Box menu to create a text box for the report title. Type “Internet Sales Analysis” and format as needed. Position the text box on top of the report.

3.Note the Fields pane shows only table “Internet Sales” because the Internet Sales dataset, which you imported from an Excel file, has only one table.

4.Click the Save menu and save the report as Internet Sales Analysis. Remind yourself to save the report (you can press Ctrl-S) every now and then so that you don’t lose changes.

NOTE Power BI times out your session after a certain period of inactivity to conserve resources in a shared environment. When this happens and you return to the browser, it’ll ask you to refresh the page. If you have unsaved changes, you might lose them when you refresh the page so get in the habit to press Ctrl-S often.

Creating a Bar Chart

Follow these steps to create a bar chart that shows the top selling products.

1. In the Fields pane, check the SalesAmount field. Power BI defaults to a Column Chart visualization that displays the grand total of the SalesAmount field.

1.Check the Product field. Power BI adds it to the Axis area of the chart.

2.In the Visualizations pane, click the Bar Chart icon to flip the Column Chart to a Bar Chart. Power BI sorts the bar chart by the product name in an ascending order.

3.Point your mouse cursor to the top-right corner of the chart. Click the ellipsis “…” menu and change the sorting order to sort by SalesAmount in a descending order. Compare your results with the “SalesAmount by Product” visualization in upper left of Figure 3.20.

TIP Clicked the wrong button or menu? Don’t worry, you can undo your last step by pressing Ctrl-Z. To undo multiple steps in a reverse order, press Ctrl-Z repeatedly.

Adding Card visualizations

Let’s show the total sales amount and order quantity as separate card visualizations (items 2 and 3 in Figure 3.20) to draw attention to them:

1. Click an empty space on the report canvas outside the Bar Chart to deactivate it.

TIP As I explained, another way to create a new visualization is to drag a field to an empty space on the canvas. If the field is numeric, Power BI will create a Column Chart. For text fields, it’ll default to a Table.

1.In the Field list, check the SalesAmount field. Change the visualization to Card. Position it as needed.

2.Repeat the last two steps to create a new card visualization using the OrderQuantity field.

Creating a Combo Chart visualization

The fourth chart in Figure 3.20 shows how the sales amount and order quantity change over time:

1. Drag the SalesAmount field and drop it onto an empty area next to the card visualizations to create a Column Chart.

1.Drag the Date field and drop it onto the new chart.

2.Switch the visualization to “Line and Stacked Column Chart”. This adds a new Line Values area to the Visualizations pane.

3.Drag the OrderQuantity field and drop it on the Line Values area. Power BI adds a line chart to the visualization and plots its values to a secondary Y-axis. Compare your results with the “SalesAmount and OrderQuantity by Date” visualization (item 4 in Figure 3.20).

Creating a Matrix visualization

The fifth visualization (from Figure 3.20) represent a crosstab report showing sales by product on rows and years on columns. Let’s build this with the Matrix visualization:

1. Drag the SalesAmount field and drop it onto an empty space on the report canvas to create a new visualization. Change the visualization to Matrix.

1.Check the Product field to add it to the visualization on rows.

2.Drag the Year field and drop it on the Columns zone to pivot on Year on columns.

3.Resize the visualization as needed. As an optional step, click any of the column headers to sort the visualization interactively in an ascending or descending order.

Creating a Column Chart visualization

The sixth visualization listed shows sales by year:

1. Create a new visualization that uses the SalesAmount field. Power BI should default to Column Chart.

1.In the Fields pane, check the Year field to place it in the Axis area of the Column Chart.

Filtering the report

Next, you’ll implement page-level and visual-level filters. Let’s start by creating a page- level Date filter that will allow you to filter all visualizations on the page by date.

1. Click an empty area on the report canvas to make sure that no visualization is activated.

1.Drag the Date field onto the Page Level Filters area. This creates a page-level filter that filters all visualizations on the activated page.

2.Practice different ways to filter. For example, switch to Advanced Filtering mode and

filter out dates after June 30th, 2008, as shown on the left screenshot in Figure 3.21.

3.To work with visual-level filters, click the fifth (Matrix) visualization. To practice another way to create a filter besides drag and drop, hover on the Product field in the Fields pane. Then expand the ellipsis menu and click Add Filter.

Because there’s an activated visualization, this action configures a visual-level filter.

Notice that the Visual Level Filters (see the right screenshot in Figure 3.21) already includes the three fields used in the visualization so that you can filter on these fields without explicitly adding them as filters.

Figure 3.21 The Advanced Filter mode (left screenshot) allows you to specify more complex criteria and multiple conditions for filtering, such as filter dates where the Date field is after June 30th, 2008. The Visual Level Filters area (right screenshot) includes by default all the fields that are used in the visualization.

Creating a Treemap

Let’s add a second page to the report that will help you analyze product sales using a Treemap visualization (see Figure 3.22).

Figure 3.22 The Treemap visualization helps you analyze product sales.

1. At the bottom of the report, click the plus sign to add a new page. Rename the page in place to Treemap.

1.In the Fields list, check the SalesAmount and Product fields.

2.Change the visualization type to Treemap.

3.By default, Power BI uses arbitrary colors for the tree map tiles. Assuming you want to color the bestselling products in green and worst-selling products in red, drag the

SalesAmount field to the Color Saturation area of the Visualizations pane.

4.In the Format tab of the Visualizatons pane, change the Data Colors settings, as shown in Figure 3.22. Turning of the Diverging option allows you to specify a color for the values that fall in the middle. You can use the Minimum, Center, and Maximum fields to fine tune the ranges.

Một phần của tài liệu Applied microsoft power bi Bring your data to life (Trang 104 - 107)

Tải bản đầy đủ (PDF)

(447 trang)