Show a value only where it makes sense with HASONEVALUE

Average price paid per unit means something for one product but not for bikes and water bottles mixed together, so blank it out everywhere else.

You will learn to

  • Test the filter context with HASONEVALUE
  • Return blank where a number would mislead
  • Read the single selected value with SELECTEDVALUE

How it works

A measure can ask questions about its own filter context. `HASONEVALUE(Product[Product])` is true when exactly one product is visible, as in a product row of a matrix. In a category row or the total row, several products are visible, so it’s false.

`SELECTEDVALUE(Customer[Region], "All Regions")` goes one step further: it returns the one visible value, or the fallback when there are several. That makes it handy for dynamic titles. `ISFILTERED(column)` asks whether a column is filtered directly.

Pair them with `IF`: `IF(condition, value)` returns blank when the condition is false, and Power BI hides blank cells.

Practice it hands-on with a real data model and a live report that updates as you type.

Sales Title = "Sales for " & SELECTEDVALUE(Customer[Region], "All Regions")