Sub topic 9
Default tooltips and the Tooltips field well
This chapter assumes you can build bar charts and tables in Power BI Desktop, know what filter context is, and can write a simple DAX measure. It covers the tooltip every visual shows by default and how to extend it with the Tooltips field well. Report page tooltips come in a later chapter.
What a default tooltip shows
A tooltip is a small box that appears when a reader hovers over a data point. Power BI builds a default tooltip for every visual. It lists the values that define the hovered point:
- The category or axis value, such as the product category under the cursor.
- The legend value, if the visual has a legend.
- Every measure in the Values well, with its current value.
These numbers come from the filter context of the data point. In a bar chart of Total Sales by Category, hovering over the "Bikes" bar shows Category = Bikes and the sales for Bikes. The tooltip describes exactly the slice of data the bar represents.
Adding measures with the Tooltips field well
Sometimes you want more detail than the visual's own fields. The Tooltips field well lets you add extra fields without changing the chart.
- Select the visual.
- In the Visualizations pane, open the Build visual tab.
- Drag a measure or column into the Tooltips well.
The new field appears in the tooltip on hover. It does not change the bars, the axis, or the sort order. Power BI evaluates it in the same filter context as the hovered point.
The year-over-year measures from the plan work well here:
Sales PY =
CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )
Sales YoY % =
DIVIDE ( [Total Sales] - [Sales PY], [Sales PY] )Add Sales YoY % to the Tooltips well of a column chart of sales by category. Hovering over a column now shows current sales and the change from last year. The chart stays simple, and the comparison is available on demand.
Controlling what appears
Several settings change the default tooltip:
| Setting | Effect |
|---|---|
| Rename a field in the well | The tooltip label changes, and so does the visual's label. |
| Format the measure | Number format, such as percentage, applies in the tooltip. |
| Aggregation on a column | Columns in the Tooltips well can be summed, averaged, or counted. |
| Format pane, Tooltips, Type: Default | Keeps the automatic tooltip. |
| Format pane, Tooltips, Type: Report page | Uses a tooltip page instead. This is covered in the next chapter. |
You can also turn tooltips off for a visual in the same Format pane section.
Common errors
- Tooltip shows a total instead of the point's value. The measure may use
ALLorREMOVEFILTERS, which removes the filter context of the hovered point. Check the measure. - The year-over-year value is blank.
SAMEPERIODLASTYEARneeds a proper, marked date table with continuous dates. Without it, the prior period returns blank. - A field you added does not appear. Fields in the Tooltips well show only for visuals that support them. Some visuals, such as slicers, have no tooltips.
- Tooltip is too crowded. A long list of fields hides the main point. Keep it to a few that answer "compared to what?".
Exercise
A column chart shows Total Sales by Category. You drag the Sales YoY % measure into the Tooltips well. Does the chart's columns or sort order change, and in what filter context is the measure evaluated when a reader hovers over the "Bikes" column?
Show answer
The columns and sort order do not change, because the Tooltips well only adds information to the hover box. The measure is evaluated in the filter context of the hovered point, so it shows the year-over-year change for the Bikes category.
Exercise
A tooltip measure returns the same value for every bar. Name one likely cause in the measure's DAX.
Show answer
The measure probably removes the point's filter context, for example with ALL or REMOVEFILTERS, so each hover evaluates the whole dataset instead of one category.