Create and format interactive visualizations

Một phần của tài liệu Analyzing and visualizing data by using microsoft power BI (Trang 135 - 153)

MORE INFO ALL MICROSOFT CERTIFICATIONS

Skill 2.5: Create and format interactive visualizations

Once you have connected to the data sources and created a data model, the next step is to create visualizations. One of the things that sets Power BI apart from other visualization tools is that you can create interactive visualizations—that is, visuals, that can interact with each other by cross- filtering the underlying data.

This section covers how to:

Select a visualization type

Configure page layout and formatting Configure interactions between visuals Configure duplicate pages

Handle categories that have no data

Configure default summarization and data category of columns Position, align, and sort visuals

Enable and integrate R visuals Format measures

Select a visualization type

So far in this chapter, we have already worked with some visuals, including Gauge, Card, Multi-row Card, KPI, Slicer, Table, and Matrix. In this section, we are going to review some other standard Power BI visuals.

NOTE CHOOSING THE RIGHT VISUAL

SQLBI has created a concise reference that can help you with selecting the right visual. It lists all the standard visuals and many custom ones. For more details, see “Power BI Visuals Reference” at https://www.sqlbi.com/ref/power-bi-visuals-reference/.

Bar charts

Power BI has six variations of bar charts:

Stacked bar chart Stacked column chart Clustered bar chart Clustered column chart 100% Stacked bar chart 100% Stacked column chart

All six charts share the same five field wells:

Axis You can use one or more categorical columns in this field well.

Legend One categorical column can be used.

Value You can use one or more numerical fields; if you use a legend or color saturation, you can only put one field into this field well.

Color saturation One numerical field can be used.

Tooltips You can use one or more fields here

You can see all six variations of bar charts in Figure 2.69 with titles manually set to reflect the chart type.

FIGURE 2.69 Six bar chart types

It is best to use bar charts when you are comparing values across categories. If you want to compare values across time, it is best to use line charts, which are covered next.

MORE INFO FORMATTING VISUALS

You can customize many items in the Format pane, including the title, legend, background, axes and change colors in the Format pane. To learn more, see ”Customize visualization titles, legends, and backgrounds (Tutorial)” at https://docs.microsoft.com/en-us/power-bi/power- bi-visualization-customize-title-background-and-legend, and “Getting started with color formatting and axis properties” at

https://docs.microsoft.com/en-us/power-bi/service-getting-started-with-color-formatting-and-axis-properties.

Line and area charts

Power BI has a line chart and two area charts, which are similar to the line chart, but have a shaded area under the lines:

Line chart Area chart Stacked area chart

All three charts have the following field wells:

Axis For one or more categorical columns.

Legend For one categorical column.

Values One or more numerical fields can be used; if you use a legend, you can only use one field in this well.

Tooltips One or more fields can be used.

The three charts can be seen in Figure 2.70.

FIGURE 2.70 Line, area, and stacked area charts

Line charts are best used when you are comparing values across time.

MORE INFO AREA CHART

For a tutorial on a basic area chart, as well as considerations on using it, see “Basic Area chart (Tutorial)” at https://docs.microsoft.com/en- us/power-bi/power-bi-visualization-basic-area-chart.

Combo charts

There are two combo charts in Power BI:

Line and stacked column chart Line and clustered column chart Both charts have five field wells:

Shared axis One or more categorical columns.

Column series A legend well in which you can use a categorical column.

Column values You may use one or more numerical fields in this well; if you have a column series, you can only use one field.

Line values One or more numerical fields may be used in this well.

Tooltips One or more fields may be used in this well.

You can see the two charts used in Figure 2.71.

FIGURE 2.71 Combo charts

Combo charts can be the appropriate choice when you plot two fields that have very different value range for instance, dollar amounts and percentages. By default, the column values appear on the right, and the line values appear on the left. In the Format settings, you can switch the axes, as well as hide one or the other.

MORE INFO COMBO CHARTS

For more information on combo charts, including areas of application and formatting options, see “Combo Chart in Power (Tutorial)” at https://docs.microsoft.com/en-us/power-bi/power-bi-visualization-combo-chart.

Ribbon chart

The Ribbon chart is similar to a column chart, but it has ribbons between the bars to highlight changes in the relative ranking of categorical items. The item with the highest value will be displayed on top.

The chart has four field wells:

Axis One or more categorical columns.

Legend You may use one categorical column.

Value You can use one or more numerical fields in this well; if you use a legend, you can use one field only.

Tooltips You may use one or more fields.

You can see a ribbon chart used in Figure 2.72.

FIGURE 2.72 Ribbon chart

Note how Figure 2.72 shows that almost every year, the ranking of Buying Group items by Total Actual Amount is as follows:

1. N/A 2. Tailspin Toys 3. Wingtip Toys

The exception is CY2015, in which Wingtip Toys overtook Tailspin Toys as number two.

MORE INFO RIBBON CHART

For more information on using the Ribbon chart, including formatting options, see “Use ribbon charts in Power BI” at https://docs.microsoft.com/en-us/power-bi/desktop-ribbon-charts.

Waterfall chart

The Waterfall chart shows color-coded values in a running total fashion. By default, positive values are green, while negative values are red. This visual has four field wells:

Category One or more categorical columns.

Breakdown You may use one categorical column.

Y Axis One numerical field.

Tooltips You may use one or more fields.

You can see two waterfall charts: one with and one without a breakdown for three calendar years in Figure 2.73.

FIGURE 2.73 Waterfall charts

Note how when you use breakdown, only the top five items are shown by default, with the rest being grouped into Other. The Other group is yellow because it may contain both Increase and Decrease items. You can change the colors, as well as number of breakdowns in the Formatting pane.

IMPORTANT TOTAL IN WATERFALL CHART

Be aware that the total in waterfall chart is an arithmetic sum of the items, not the value that you would see without filtering the category, as is the case in the Table visual, for example. This behavior is especially relevant with semi-additive or non-additive measures, such as balances or averages.

A waterfall chart is a good choice when you want to show the major changes or illustrate what the total amount is made of while showing the total at the same time for comparison.

MORE INFO WATERFALL CHART

For more information on how you can use the Waterfall visual, including a tutorial, see “Waterfall charts in Power BI (Tutorial)” at https://docs.microsoft.com/en-us/power-bi/power-bi-visualization-waterfall-charts.

Scatter chart

The Scatter chart can visualize two or more metrics for categorical items. Each item will be plotted according to the X and Y coordinates, which will be taken from the metrics. When you use a third metric for size, the chart can be called a bubble chart. The visual has eight field wells:

Details You can use one or more categorical items in this field well; if you use more than one column, you can drill down.

Legend You may use one categorical column.

X Axis One numerical field.

Y Axis One numerical field.

Size One numerical field.

Color saturation One numerical field may be used; when you use legend, you cannot use color saturation.

Play Axis One categorical column ideally, but not necessary, the time column.

Tooltips You may use one or more fields.

An example of a scatter chart is shown in Figure 2.74.

Figure 2.74 Scatter chart

Note how easy it is to see one item that is an outlier: its price is almost five times the second-most expensive price. If you hover over the bubble, you see that it is Air cushion machine (Blue). Scatter charts can be a powerful way to show a relationship between two metrics or highlight outliers.

MORE INFO SCATTER CHART

For a video tutorial and more details on how scatter charts can be used, including formatting options, see “Scatter charts and bubble charts in Power BI (Tutorial)” at https://docs.microsoft.com/en-us/power-bi/power-bi-visualization-scatter.

Pie and doghnut charts

The Pie and Doghnut charts are the same except the latter has empty space in the middle. Both charts have four field wells:

Legend For one or more categorical columns.

Details You may use a categorical column.

Values You may use one or more numerical fields here; if you use Details, you are limited to one field only.

Tooltips You may use one or more fields here.

You can see both charts shown in Figure 2.75:

Figure 2.75 Pie and Donut charts

You can use these charts to show the relationships of parts to the whole. Both charts are not considered best practice in data visualization with one exception: you may use a pie or a doghnut chart when there are only two categories. Otherwise, if you are sure that users will not be comparing parts to each other, only to the whole, you may use these charts. But be aware that having too many items will make reading and interpreting values difficult.

MORE INFO DOGHNUT CHART

For more details on the Doghnut chart, including considerations, see “Doughnut charts in Power BI (Tutorial)” at https://docs.microsoft.com/en-us/power-bi/power-bi-visualization-doughnut-charts.

Treemap

Treemap charts can be thought of as rectangular pie charts because they also show the relationship of the parts to the whole. You can nest rectangles to further divide the whole. There are five field wells:

Group For one or more categorical columns.

Details You may use a categorical column.

Values You may use one or more numerical fields here; if you use Details, you are limited to one field only.

Color saturation You may use a numerical field here unless you are using Details.

Tooltips You may use one or more fields here.

For example, create a Treemap visual with Sales Territory as the group, State Province for the details, and Total Actual Amount as the values.

The resulting chart is shown in Figure 2.76.

Figure 2.76 Treemap

In this case, the size of each rectangle corresponds to Total Actual amount. The rectangles are arranged top to bottom and left to right based on numerical values in descending order.

A treemap visual can be a good choice when you want to show proportions between each part and the whole, as well as highlight the most- important contributors and outliers.

MORE INFO TREEMAP

For a video tutorial and more information on the Treemap visual, including areas of application, see “Treemaps in Power BI (Tutorial)” at https://docs.microsoft.com/en-us/power-bi/power-bi-visualization-treemaps.

Maps in Power BI

Power BI has several options when it comes to visualizing geospatial data. In this section, we are going to review two map visuals: Map and Filled Map. You can use the following field wells:

Location One or more categorical columns can be used.

Legend You may use one categorical field here.

Latitude You may use one field here.

Longitude You may use one field here.

Size For a numerical field (Map only).

Color saturation You may use a numerical field here unless you use a Legend.

Tooltips You may use one or more fields here.

When you use a Map visual, you plot bubbles on a map, with the size of each bubble corresponding to the value in the Size field well. If you are using a Legend, your bubbles will be turned into pie charts. If your Legend field well is empty, you can also use a numerical field for color saturation.

If you use geographical hierarchies in the Location field well, you will be able to drill down into specific areas on your map.

NOTE IMPROVING ACCURACY OF MAPS

Sometimes points on a map might be plotted inaccurately. To improve the accuracy of maps, you should categorize your data. Data categories are covered later in this chapter.

Figure 2.77 shows an example of a Map chart with State Province used as the location, Buying Group used as the legend, and Total Actual Amount used as the size.

FIGURE 2.77 Map example

The map in Figure 2.77 was filtered to show only the contiguous U.S. states. One way to reproduce the result is to add the CONUS column to the Visual Level Filters field well, which is in the Filters pane underneath the visual field wells, and select 1.

MORE INFO USING MAPS

For a video overview and more information on how you can use the Map visual, including tips and tricks, see “Tips and Tricks for Power BI Map visualizations” at https://docs.microsoft.com/en-us/power-bi/power-bi-map-tips-and-tricks.

When you use the Filled Map visual, also known as a choropleth map, you are not able to use the Size field well. Instead, you can use Color Saturation to highlight the difference between areas.

IMPORTANT LEGEND IN FILLED MAP

If you decide to use a legend, you need to be aware that color saturation will stop working. Furthermore, you need to make sure that each location has exactly one corresponding value in legend—otherwise all items will appear with the same color, and the color saturation value in tooltips will reflect only the first legend item, which may confuse users. Either way, if you use a legend, placing a value in the Color Saturation field well and using it as a tooltip is the same.

An example of the Filled Map is shown in Figure 2.78.

FIGURE 2.78 Filled Map

The map in Figure 2.78 uses Total Actual Amount for the color saturation and State Province as the location. This map only shows the contiguous U.S. states.

MORE INFO FILLED MAPS

For more details on how you can use the Filled Map visual, see “Filled maps (choropleths) in Power BI (Tutorial)” at https://docs.microsoft.com/en-us/power-bi/power-bi-visualization-filled-maps-choropleths.

MORE INFO OTHER MAPS

There are many other options for visualizing geographical data in Power BI, including the ArcGIS Maps for Power BI and Shape Maps.

The ArcGIS Maps allow you to customize your maps beyond the standard map capabilities. For a tutorial on how you can create ArcGIS maps in Power BI, see “ArcGIS maps in Power BI service and Power BI Desktop by Esri” at https://docs.microsoft.com/en-us/power- bi/power-bi-visualization-arcgis.

For information on how you can interact with an ArcGIS map that has already been developed, see “Interacting with ArcGIS maps in Power BI” at https://docs.microsoft.com/en-us/power-bi/power-bi-visualizations-arcgis.

With Shape maps, you can use custom maps, which need not be geographical; for example, you can use a floor plan as a map. For more information on using Shape maps, see “Shape Maps in Power BI Desktop (Preview)” at https://docs.microsoft.com/en-us/power-bi/desktop- shape-map.

Custom visuals, which are covered later in this chapter, also allow you to visualize spatial data in many ways. For a comprehensive overview, see “10 Ways to Create Maps in Microsoft Power BI” at https://dataveld.wordpress.com/2017/06/03/10-ways-to-create-maps-in- microsoft-power-bi/.

Funnel

The final visual we are going to review is the Funnel chart, which looks similar to a bar chart with bars center-aligned. The visual has four field wells:

Group You can use one or more categorical columns here.

Values You can only use a numerical field here.

Color saturation A numerical field may be used.

Tooltips One or more fields can be used here.

An example of a funnel chart i shown in Figure 2.79.

Figure 2.79 Funnel chart

Note that the Funnel displays the last item relative to the first item.

A funnel chart can be a proper choice for showing values by stages, for instance, by lead generation stages. The visual can also be used for revealing bottlenecks in a process or to track workflow.

MORE INFO FUNNEL CHART

For a video tutorial and more information on how you can create a funnel chart, including areas of application, see “Funnel charts (Tutorial)” at https://docs.microsoft.com/en-us/power-bi/power-bi-visualization-funnel-charts.

Configure page layout and formatting

By default, the size of each page in Power BI Desktop is 1280 by 720 pixels. You can modify this size by selecting the Format pane after making sure that no visual is selected. You will then see three sections:

Page Information Page Size Page Background

In Page Information, you can give the page a new name and aliases, as well as choose whether Q&A is enabled for this page. You can also rename a page by either double-clicking on its tab or right-clicking on the tab and selecting Rename Page.

MORE INFO Q&A

Q&A is the natural language processing ability of Power BI, which can visually answer questions about your data. The Q&A feature is covered in Chapter 3.

In Page Size, you can select one of the preset page sizes, or specify a custom size in pixels. The preset sizes are as follows:

16:9 (1280 by 720 pixels) 4:3 (960 by 720 pixels) Cortana (296 by 592 pixels) Letter (816 by 1056 pixels)

In Page Background, you can choose the background color and specify transparency. Also, you can choose a background image and three options to scale it:

Normal Displays the image in its original size.

Fit Stretches the image to canvas size without keeping proportions.

Fill Stretches the image to touch the canvas from inside, keeping proportions.

Besides page formatting, you can also adjust page view in View > View > Page View. You have three options:

Fit to Page Fit to Width Actual Size

All three options keep the proportions of a page.

Configure interactions between visuals

One of the defining features of Power BI is the interaction of visuals with each other. For example, you can click on an item in a bar chart, and it will cross-highlight a column chart. This behavior is illustrated in Figure 2.80.

Một phần của tài liệu Analyzing and visualizing data by using microsoft power BI (Trang 135 - 153)

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

(396 trang)