Sub topic 3
Drilling Down and Up in a Visual
This chapter assumes you can build bar charts and matrices in Power BI Desktop, you have a star-schema model with a date table, and you can read simple DAX measures. It also assumes you have already created a hierarchy, as covered in the previous chapter.
What drill-down does
Drill-down moves through the levels of a hierarchy inside one visual. A hierarchy is an ordered list of fields, such as Category, Subcategory, and Product Name. The visual starts at the top level. When the reader drills down, it shows the next level, scoped to the item the reader chose.
Drill-down changes the filter context of the visual. When you drill from Category into the "Bikes" category, the visual now shows Subcategory values, and only those that belong to Bikes. Drill-down does not change other visuals on the page unless you also use cross-filtering.
Turning on drill controls
A visual shows drill controls only when its axis (or rows, for a matrix) holds a hierarchy or several fields. Drill controls appear in the visual header when you hover over the visual.
| Control | What it does |
|---|---|
| Drill mode arrow (single down arrow) | Switches drill mode on or off. When on, clicking a data point drills into it. |
| Drill up arrow (up arrow) | Goes back one level. |
| Go to the next level (double arrow) | Shows all items at the next level, ignoring the current selection. |
| Expand to the next level (forked arrow) | Adds the next level below the current one, keeping both. |
This chapter covers the first three. The expand arrow is covered in the next chapter.
Worked example
Build a clustered bar chart with the hierarchy on the Y-axis and a sales measure on the X-axis.
- Add a clustered bar chart to the page.
- Drag the Product hierarchy (Category, Subcategory, Product Name) into Y-axis.
- Drag
[Total Sales]into X-axis. - Hover over the visual and select the drill mode arrow so it is highlighted.
- Click the "Bikes" bar. The chart now shows the subcategories of Bikes only.
- Click "Mountain Bikes". The chart now shows individual products.
- Select the drill up arrow twice to return to Category.
If you leave drill mode off, a click selects the bar and cross-filters other visuals instead. Drill mode on means a click drills. You can also right-click a bar and choose Drill down without turning drill mode on.
Measures that know the level
A measure can detect which level the visual is showing. ISINSCOPE returns true when a column is a grouping level in the current row of the visual. Check from the lowest level upward, because deeper levels are also in scope when you are at a lower level.
Level Label =
IF (
ISINSCOPE ( Product[Product Name] ), "Product",
IF (
ISINSCOPE ( Product[Subcategory] ), "Subcategory",
IF ( ISINSCOPE ( Product[Category] ), "Category", "Total" )
)
)Add this measure to a table or matrix with the same hierarchy. Each row shows its own level, and the grand total row shows "Total". You can use the same pattern inside other measures to change a calculation or format by level.
Common problems
- No drill arrows appear. The visual has only one field in its axis, or it is a type that does not support drilling, such as a card.
- Drilling shows the wrong values. Check that you drilled by the intended field and that the hierarchy order is correct.
- Date fields do not drill. Use the date hierarchy or build your own from columns in the date table. A plain date column has no levels.
- Clicking filters other visuals instead of drilling. Drill mode is off. Turn it on, or use the right-click menu.
Exercise
A bar chart shows Category on its axis. The reader clicks the "Accessories" bar, and the other visuals on the page filter to Accessories, but the bar chart does not move to Subcategory. What is the likely cause, and how do you fix it?
Show answer
Drill mode is off, so the click acts as a selection that cross-filters other visuals. Turn on drill mode with the arrow in the visual header, or right-click the bar and choose Drill down. Also confirm the axis holds a hierarchy with a Subcategory level.