Microsoft Power BI Complete Reference
上QQ阅读APP看书,第一时间看更新

The Matrix visual

Where a table does a great job of allowing users to consume tons of detailed data about a single category, the Matrix visual can accomplish this for more than one category. The Matrix visual allows users to not only select a category for the rows, but means we can also select a field to populate the columns, which allows us to see detailed data at a cross section for two categories. Conditional formatting is also available for use within the Matrix visual, and is incorporated in the same fashion as we accomplished in the previous example. Other than Conditional Formatting, the Matrix visual can take advantage of established hierarchies to give users that capability of drilling down into more granular data. Many of the other visuals can also take advantage of hierarchies, but for tabular data the Matrix visual does a great job with this.

Let's look at, setting up the visual:

  1. Ensure that you do not have any other visual selected, and choose the Matrix visual from the visual's area.
  2. Firstly, we will populate the Rows area with our Sales Territory Drilldown, which you will find under the Sales Territory table. You will see that when we place a check mark next to the Sales Territory Drilldown option, it brings in three different fields, starting with Sales Territory Group.
  3. Next, we will select what is known as a natural hierarchy which Power BI automatically creates from our Date (Order) table. Place a check mark next to the Date field, which will bring in the Year, Quarter, Month, and Day fields. If these fields do not automatically become populated in the Columns area, just drag them to that location. Now, we have our two categories with options to drill down to get more granular data.
  4. Lastly, let's add two measures to the Matrix under the Values area. Select both the Total Sales and Profit measures. See Figure 5-9 for reference. Move and resize the Matrix as you see fit:
Figure 5-9

Now, we can see that the amount of data available to us is even greater than that of the Table visual. We should apply the same format changes to the Text Size as we did for the table at this point. The Matrix allows us to see fantastically detailed information about the different geographic regions, as well as a breakdown per year. Also, you will see that there are some new icons in the upper left of the visual which relate to the drilldown feature we spoke of earlier. Because we have hierarchies on both the rows and columns, we must decide which we would like to expand for further details. We will focus solely on the rows option and expand upon the geographical category. The first upward pointing arrow, which should be currently grayed out, allows users to move up a level in the hierarchy, but we are currently at the highest level. The option just to the right of this, which is depicted by two disconnected downward arrows, will change the category to the next level of the hierarchy, which is the Sales Territory Country in our example. Let's go ahead and select this option two times so that we are displaying the Sales Territory Region. The third option, which is depicted by two connected downward arrows will also go down one level at a time through the hierarchy, but it will also retain the previous (higher) category. By having the Matrix and Table next to each other, you can see the difference in detail that can be achieved by each of them. Both, though, can benefit greatly from Conditional Formatting