It is one thing to have a game-changing insight that can fundamentally alter the way your business works. It is quite another to be able to convince your colleagues of your vision. So what better way to show them—intuitively and instantaneously—that you are right than with a chart that makes your point irrefutably?
Power View is predicated on the concept that a picture is worth many thousands of words. Its charting tools let you create clear and convincing visualizations that tell your audience far more than a profusion of figures ever could. This chapter, therefore, will show you how simple it can be not just to make your data explain your analysis, but to make it seem to leap off the screen. You will see over the next few pages how a powerful chart can persuade your peers and bosses that your ideas and insights are the ones to follow.
A little more prosaically, Power View lets you make a suitable data set into
In this chapter we will get up and running by looking at creating pie, bar, column, and line charts. The other chart types will be discussed in the next chapter. Once you have decided upon the most appropriate chart type, you can then enhance your visualization with titles, data labels, and legends, where appropriate. We will also see how to apply drill-down techniques to charts and how to filter the data that underlies them.
The sample file for this chapter is CarSales.xlsx, which you should find in the directory C:HighImpactDataVisualizationWithPowerBI—assuming you have installed the samples as described in Appendix A.
A First Chart
As with so much in Power View, it is easier to appreciate its simplicity and power by doing rather than talking. So I suggest leaping straight into creating a first chart straightaway. In this section we will look only at “starter” charts that all share a common thread—they are based on a single column of data values and a single column of descriptive elements. This data will be
So, let’s get charting!
Any Power View chart begins as a data set. So, let me introduce you to the world of charts; this is how to begin:
Figure 4-1. A source data table for charting
Figure 4-2. Your first chart
Figure 4-3. A basic chart after resizing
And that is all that there is to creating a simple starter chart. This process might only take a few seconds, and once it is complete, it is ready to show to your audience, or be remodeled to suit your requirements.
Nonetheless, a few comments are necessary to clarify the basics of chart creation in Power View:
Figure 4-4. The layout section of the fields list for a clustered bar chart
Deleting a chart is as simple as deleting a table. All you have to do is
If you remove all the fields from the Layout section of the Field List (with the chart selected), then you will also delete the chart.
So you have an initial chart. Suppose, however, that you want to change the actual data on which the chart is based. Well, all you have to do to change both the axis elements, the client names, and the values represented, is
Figure 4-5. A simple bar chart with the corresponding layout section
That is it. You have changed the chart completely without rebuilding it. Power View has updated the data in the chart and the chart title to reflect your changes.
Basic Chart Types
When dealing with a single set of values, you will probably be using the following four core chart types:
Let’s see how we can try out these types of chart using the current data set—the colors and Gross Margin that you applied previously.
A column chart is, to all intents and purposes, a bar chart where the bars are vertical rather than horizontal. So, to switch your bar chart to a column chart
Figure 4-6. An elementary column chart
A line chart displays the data as a set of points joined by a line. To switch your column chart to a line chart
Figure 4-7. A simple line chart
Pie charts can be superb at displaying a limited set of data for a single series—like we have in this example. To switch the visualization to a pie chart
Figure 4-8. A basic pie chart
A pie chart will be distorted if it includes negative values at the same time as it contains positive values. What Power View will do is display the negative values as if they were positive, because otherwise the values cannot be displayed. This is probably not the effect that you were hoping for. If your data set contains a mix of positive and negative data, then Power View will display an alert above the chart warning you that the Pie Chart Contains Positive And Negative Values. You can see which pie slices contain negative values by hovering the mouse pointer over each slice and reading the values in the popup that appears.
In practice, you may prefer not to use pie charts when your data contains negative values, or you may want to separate out the positive and negative values into two data sets and display two charts, as explained in the “Chart Filters” section later in this chapter.
Note Juggling chart size and font size to fit in all the elements and axis and/or legend labels can be tricky. One useful trick is to prepare “abbreviated” data fields in the source data, as has been done in the case of the QuarterAbbr field in the Date table that contains Q1, Q2, and so on, rather than Quarter 1, Quarter 2, and so on to save space in the chart. Techniques for this sort of data preparation are given in Chapter 10.
Essential Chart Adjustments
Creating a chart in Power View is, I hope you will agree, extremely simple. Yet the process of producing a telling visualization does not stop when you take a table of data and switch it into a chart. At the very least, you will want to make the following tweaks to your new chart:
None of these tasks is at all difficult. Indeed it can take only a few seconds to transform your initial chart into a compelling visual argument—when you know the techniques to apply.
A chart is like any other visualization on the Power View report and can be resized to suit your requirements. To resize a chart
Note You do not have to select or click inside a chart before you resize it. Remember that the lateral handles will let you resize the chart only horizontally or vertically, and that the corner handles allow you to resize both horizontally and vertically.
When resizing a chart, you will see that this can have a dramatic effect on the text that appears on an axis. Power View will always try and keep the space available for the text on an axis proportionate to the size of the whole chart.
For bar charts, this can mean that the text can be
For column and line charts, this can mean that the text can be
If you reduce the height (for a bar chart) or the width (for a column or a line chart) below a certain threshold, Power View will stop trying to show all the elements on the non-numeric axis. Instead it will only show a few elements and will add a scroll bar to allow you to scroll through the remaining data. You can see an example of this for a bar chart in Figure 4-9.
Figure 4-9. A chart with a scroll bar visible
All this means is that you might have to tweak the size and height to width ratio of your chart until you get the best result. If you are in a hurry to get this right, I advise using the handle in the bottom right corner to resize a chart, as dragging this up, down, left, and right this will quickly show you the available display options.
You can move a chart anywhere inside the Power View report:
Sometimes you can really make a point about data by changing the order in which you have it appear in a chart. Up until this point you have probably noticed that when you create a chart, the elements on the axis (and this is true for a bar chart, column chart, line chart, or pie chart) are in alphabetical order by default. If you want to confirm this, then just take a look at Figures 4-5 to 4-8 on the preceding pages.
Suppose now, for instance, you want to show the way that sales are affected by the color of the vehicle. In this case, you want to sort the data in a chart from highest to lowest so that you can see the way in which the figures fall, or rise, in a clear order. Here is how to do this:
Figure 4-10. The sort area in a chart
Figure 4-11. Sorting data in a bar chart
If a chart has multiple values, as will be the case for some of the charts that you will see further on in this chapter, then you have two options when selecting the field on which the chart will be ordered:
Figure 4-12. Selecting the sort element in a chart
I should add just a short remark about sorting pie charts. When you sort a pie chart, the pie chart will be sorted clockwise, starting at the top of the chart. So if you are sorting colors by GrossMargin in descending order, the top selling color will be at the top of the pie chart (at 12 o’clock), with the second bestselling color to its immediate right (2 o’clock, for example) and so on. An example of this is shown in Figure 4-13.
Figure 4-13. Sorting data in a pie chart
When a chart is initially created, Power View will apply a default font size. This font size will not change proportionally if you resize the chart. This does not, however, mean that Power View fixes font sizes definitively. You can influence matters by choosing proportionally to reduce, or increase, the size of the fonts used on both axes of the chart. You can do this in the following way:
Adjusting the font size will produce many of the same effects that you saw when you were resizing a chart; namely, text on the axes will be
If Power View considers the text too large to display all the elements in the chart, then it will only show a few elements and will add a scroll bar to allow you to scroll through the remaining data.
Applying Color to Bar and Column Charts
The bar and column charts that we have created so far are a little lacking in color, as every bar or column is the same shade. If you want to add a splash of color, then you can override the default and make Power View apply a palette of colors to the bars and columns for a chart based on a single data element.
For example, take the column chart shown in Figure 4-5; all you have to do is
You can see the result in Figure 4-14. The axis titles are now the legend elements, and the bars are in different colors. Admittedly, on the printed page you cannot see the colors, but the shading indicates that your changes have worked! You can get a similar result for a bar chart.
Figure 4-14. Applying a color palette to individual columns
Note You cannot sort a chart like this one—one that does not have any axis values.
Multiple Data Values in Charts
So far in this chapter we have seen simple charts that display a single value. Life is, unfortunately, rarely that simple, and so it is time to move on to slightly more complex, but possibly more realistic, scenarios where you need to compare and contrast multiple data elements.
For this set of examples, I will presume that we need to take an in-depth look at the indirect cost elements of our car sales to date. These are
All of these can be found in the CarSalesData table.
Consequently, in order to begin with a fairly simple comparison of these indirect costs, let’s start with a clustered column chart:
Figure 4-15. Multiple data values in charts—a clustered bar chart with the layout section shown
You will notice that a chart with multiple data sets has a legend by default, and that the automatic chart title now says SpareParts, DeliveryCharge, And LaborCost By ClientName.
The same data set can be used as a basis for other charts that can effectively display multiple data values. These are
As column charts are essentially bar charts pivoted through 90 degrees, I will not show examples of these here. However, in Figures 4-16 and 4-17, you will see examples of a stacked bar chart and a line chart. You will also see that when creating these types of visualization, the Layout section of the Field List remains the same for all of these charts.
Figure 4-16. A simple stacked bar chart
Figure 4-17. An introductory line chart
Note You cannot create a stacked bar or stacked column chart directly from a table that has multiple numeric data values; so you have two choices: either you start with a table containing only one numeric data value and then drag the other numeric fields that you wish to use onto the stacked chart (or into the  VALUES box), or you start with a clustered chart that you then convert into a stacked chart.
To conclude our tour of basic charts, I just want to make a couple of comments.
First, you can always see exactly what the figures behind a bar, column, line, point, or pie segment are just by hovering the mouse pointer over the bar (or column, or line, or pie segment). This will work whether the chart is its normal size, or whether it has been popped out to cover the Power View report area. An example of this is given in Figure 4-18.
Figure 4-18. A clustered bar chart with the popup displayed
Second, however much work you have done to a chart, you can always switch it back to a table if you want. Simply select the chart, and select the required table type from the Table button in the Design ribbon. If you do this, you will see that the table attempts to mimic the design tweaks that you applied to the chart, keeping the font sizes the same as in the chart, and the size of the table identical to that of the chart. Should you subsequently switch back to the chart, then you should find virtually all of the design choices that you applied are still present—unless, of course, you made any changes to the table before switching back to the chart visualization.
You have already seen most of the basic charting techniques. I hope that you found them as simple as I promised they would be. So, before we move on to the next level, I really should explain a new Power View ribbon that appears every time you click on a chart. It is the Layout ribbon.
The Layout ribbon is largely devoted to enhancing charts in Power View. The buttons it contains are outlined in Figure 4-19.
Figure 4-19. The Layout ribbon
There are only a few buttons in the Layout ribbon, and they are, fortunately, largely intuitive. Should you need a reference, then a detailed explanation of their use is given in Table 4-1.
Table 4-1. The Layout Ribbon Buttons
Button |
Description |
---|---|
Title |
Adds or removes a title from the chart. |
Legend |
Lets you choose where (if at all) the legend is placed on a chart. |
Data Labels |
Lets you decide to add or hide data labels and choose where they are placed. |
Map Background |
Adds a thematic background to a map. This is explained in Chapter 7. |
Axis Type |
Lets charts have continuous or interrupted axes. |
Grid Height |
Allows you to choose the number of vertical charts that can be displayed if multiples are selected. |
Grid Width |
Allows you to choose the number of horizontal charts that can be displayed if multiples are selected. |
Axes |
Synchronizes chart axes when tiles are added to a chart. |
Colors |
Synchronizes chart colours across the tiles when tiles are added to a chart. |
Bubbles |
Synchronizes chart bubble sizing when tiles are added to a chart. |
Enhancing Charts
Now that you have been introduced to the Layout ribbon and have mastered basic charts, it is time to move on to the next step and learn how to tweak your charts to the greatest effect. The next few sections are, consequently, devoted to the various techniques available in Power View to give your charts real clarity and power.
If you have a chart with more than one field that provides the values on which the chart is based, then you will see a legend appear automatically. The default for the legend is for it to be placed on the right of the chart. However you can choose where to place the legend, or even whether to display it at all, by choosing from one of the options that appear when you click on the Legend button in the Layout ribbon.
The available options are given in Table 4-2.
Table 4-2. Legend Position Options
Legend Option |
Comments |
---|---|
None |
No legend is displayed for this chart. |
Show Legend At Right |
The legend is displayed at the right of the chart. |
Show Legend At Top |
The legend is displayed above the chart. |
Show Legend At Left |
The legend is displayed at the left of the chart. |
Show Legend At Bottom |
The legend is displayed below the chart. |
If one of the legend options is grayed out, it is because this is the option that is currently active.
Legends can require a little juggling until they display their contents in a readable way. This is because the text of the legend is often truncated when it is initially displayed. If this is the case, you have two options:
Do not hesitate to try both these methods, and to switch between the two, as Power View will often end up by displaying the legend in a way that suits your requirements as you adjust these two aspects of the chart display.
Note A legend can contain a scroll bar (vertical for legends to the left or right or horizontal in the case of legends above or below the chart). This can be both extremely useful if you are dealing with many elements in a legend and extremely disconcerting if you are not expecting it!
Each chart is created with a title explaining what the chart is displaying, that is, the fields on which it is based. Here, the available options are fairly simple, as you can only choose between displaying the title or not.
You can always add further annotations to a chart using free-form text boxes. This is described in Chapter 7.
As we have seen already, you can display the exact data behind a column, bar, or point in a line chart simply by hovering the mouse pointer over the data that interests you. Yet there could be times when you want to display the values behind the chart permanently on the visualization. This is where data labels come into play.
To add data labels to a chart (in this example I will use the chart shown in Figure 4-11, which we created previously), all you have to do is
Power View will add data labels to the chart as shown in Figure 4-20.
Figure 4-20. A bar chart with data labels applied
As you will have seen when you were clicking on the Data Labels button, Power View gives you several options concerning the placement of data labels in a chart. These options are explained in Table 4-3.
Table 4-3. Data Labels for Column and Bar Charts
Data Label Option |
Comments |
---|---|
None |
No data labels will be superimposed on the chart. |
Center |
The data label will be displayed (if possible) inside the data area. |
Inside End |
The data label will be displayed (if possible) inside the data area, at the top end of the bar or column. |
Inside Base |
The data label will be displayed (if possible) inside the data area, at the top end of the bar or column. |
Outside End |
The data label will be displayed (if possible) outside the data area, at the top end of the bar or column. |
When applying data labels to line charts, the possible options are somewhat different than those offered for bar and column charts. Options for line charts are given in Table 4-4.
Table 4-4. Data Labels for Line Charts
Data Label Option |
Comments |
---|---|
None |
No data labels will be superimposed on the chart. |
Auto |
Power View will place the data labels as it sees best. |
Center |
Data labels will be placed across each point on the chart. |
Left |
Data labels will be placed to the left of each point on the chart. |
Right |
Data labels will be placed to the right of each point on the chart. |
Above |
Data labels will be placed above each point on the chart. |
Below |
Data labels will be placed below each point on the chart. |
Note When applying data labels to column, bar, and line charts, you will notice that sometimes Power View cannot, physically, place all the data labels exactly where the option that you have selected implies that they should appear. This is because on some occasions there is simply not enough space inside a bar or column at the upper or lower end of a chart, to fit the figures as, the bar or column is too small. In these cases, Power View will place the data outside the bar or column. On other occasions, the data cannot fit outside a line, column, or bar without being placed above the upper end of the axis. Here again, Power View will tweak the presentation to get as close as possible to the effect that you asked for.
There are a few final points to note on the subject of data labels:
Drilling Down
In Chapter 2, we saw that Power View lets you drill down into tables, level by level, to pursue your analyses of the underlying data. Well, it probably comes as no surprise to discover that you can also drill down into the data that is displayed as charts, as well as drill back up again. As an example of this, let’s imagine that you want to take a look at average direct costs and average sale costs. Yet you want to see these
Let’s see how this can be done.
Figure 4-21. The top level in a drill-down chart
Figure 4-22. A lower level in a drill-down chart
Figure 4-23. The Drill-Up icon in a chart visualization
Drilling up will return you to the initial chart, as seen in Figure 4-20.
Now, the technique that I just explained is not the only way to create a drill-down chart. I would argue that it is probably the easiest to do when you are new to Power View, or if you are testing things out as you try and find a suitable visualization to express your findings in visual form. However, and in the interests of completeness, there is another way that I tend to use in practice. It consists of
To create a drill-down chart using this alternative approach
Note AS you can see, you did not add CarAgeBucket (from the SalesData table) yet. Also you need to make sure that the values are set to use the Average aggregation type.
Figure 4-24. A clustered bar chart using average aggregations
Figure 4-25. The Fields List Layout section for a clustered bar chart and average aggregations
Nothing in the chart has changed; yet, if you double-click on any bar, you drill down to the next level. If you were to try this with Switzerland, for instance, you would see what appears in Figure 4-26.
Figure 4-26. Drilling down inside a chart
You can add multiple levels to the axis of a chart into which you wish to drill down. If you want to change the order of the elements used to provide the levels you use to drill down, then all you have to do is alter the arrangement of the field names in the AXIS box of the field names Design area by dragging them up or down.
You can remove a level in this hierarchy in one of two ways:
As it is all too easy to get lost when using charts with multiple hierarchical levels, I advise you to take a look at the chart title before drilling up or down. This way you can always see which level in the data hierarchy is currently displayed. Also, you can always see if you are at the top of a hierarchy—the drill up icon will never appear at the top right of a chart.
Once you have perfected the appearance of a chart, you could decide to zoom in to the chart for a detailed look. This is incredibly easy:
Figure 4-27. The Pop Out icon
The chart will expand to cover the entire area of the Power View report. Not only that, but the following changes will be visible:
Take a look at the chart you created previously in Figure 4-15; once it has been popped out, you can see that a much clearer representation of the underlying data is available. Indeed, to get the full effect of a pop out, it is probably better to see the entire Power View report, as is shown in Figure 4-28.
Figure 4-28. A popout chart
Note A popout visualization cannot be saved in its expanded version. A Power View report will always open with all visualizations in their normal state. Interestngly, you cannot delete a chart which is expanded, either.
Chart Filters
Any chart can be filtered to show a subset of the data that you want to display. Fortunately applying filters is easy, as all the filtering techniques are identical to those that I described in the previous chapter. So I will assume that you have already taken a look at Chapter 3, and here I will try and build on the knowledge you have already acquired and explain how it can be used effectively when creating chart visualizations with Power View.
To give a practical example of this, let’s take up a point that I made earlier about negative values in pie charts. To avoid giving the idea that negative gross margin is somehow positive, it would be a good idea to display two pie charts that show, respectively, clients where we made money and clients where we lost money in 2013. This is how you can do it:
Figure 4-29. A pie chart containing negative values
The report should look like Figure 4-30. I have left a popup visible to remind you that when you have extended data sets, you can always see the exact figures by floating the mouse pointer over a pie segment.
Figure 4-30. Pie charts with separate filters for each chart
Data visualization purists are, I imagine, looking at the pie chart of positive sales and muttering that there are too many elements for a single pie chart and that there are too many clients for whom the sales figures are too small to be read easily. I agree, and the solution is to split the pie chart of positive values into two charts: one for major clients, and one for the smaller clients. I will also set the chart of all middle-sized clients to be a bar chart, as there are (in my opinion) too many elements for a pie chart. So, to separate out the clients with sales under 200,000.00 (I came up with this figure by looking at the sales figures in the popup for the pie slices; I chose what seemed to be a good break point between major sales and lower sales figures), we will extend the chart filter used previously to set a filter of upper and lower boundaries for the data in the chart:
An example of how the data can be filtered to create three separate charts is given in Figure 4-31.
Figure 4-31. Individual charts with separate filters
I have jumped ahead slightly here by adding some explanatory text boxes so that the reader can see what each chart is showing. These are explained in Chapter 7 if you want to flip a few pages and find out. However what matters here is that you have seen how to fine-tune individual visualizations so that they display only the data that you want them to show.
Conclusion
The techniques described in this chapter should help you produce a real “wow” effect on your audience. You can now deliver punchy presentations where crisp clear charts help you make your point with definite panache.
We have seen how to create a set of basic chart types (pie charts, bar charts, column charts, and line charts) using one or more data values. We have also seen how to filter charts using the same filtering techniques that you learned previously.
However, charts do not end at this in Power View. There is a further range of more advanced charting possibilities that you can learn to exploit; they are the subject of the next chapter.
3.139.70.248