HASONEFILTER vs HASONEVALUE: react only to what the slicer selected

Build a label that reflects the Year slicer, not the rows of the visual, by checking for a direct filter with HASONEFILTER.

You will learn to

  • Tell a direct filter from a cross-filter
  • Use HASONEFILTER to react to a slicer
  • Explain when HASONEVALUE is TRUE without a selection

How it works

A column can end up showing one value for two reasons:

- it is **filtered directly** to one value, for example the Year slicer is set to 2025; - another column narrows it, for example a filter on 'Jan 2024' in Month Year leaves only the year 2024 visible (a **cross-filter**).

`HASONEVALUE('Date'[Year])` is TRUE in both cases: it only counts visible values. `HASONEFILTER('Date'[Year])` is TRUE only in the first case: exactly one value is selected **on that column itself**.

Use HASONEFILTER when your measure should react to what the user picked in a slicer, such as a title, a note or a “pick a year” prompt, and not to whatever else happens to filter the page.

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

Region Note = IF(HASONEFILTER(Customer[Region]), "Region: " & SELECTEDVALUE(Customer[Region]), "All regions")