The HASONEFILTER function returns the logical value True when the number of filters directly applied to the values of the indicated column is one, and returns False otherwise.
HASONEFILTER(
column
)
- column: Name of an existing column. It cannot be a DAX expression.
The HASONEFILTER function returns a Boolean.
This function is similar to the ISCROSSFILTERED function with the difference that it considers both direct and crossed filters while HASONEFILTER considers only direct filters.
A column is said to be receiving a direct filter (or being filtered directly) when the filter or filters are applied directly to the column. On the contrary, a column is said to receive a cross filter (or to be cross filtered) when the filter applied to another column in the same table or to a related table affects the column under analysis by filtering it as well.
We can find out if the Country column of the Geography table has a single active direct filter using the following measure:
hasonefilter =
IF(
HASONEFILTER(Geography[Country]),
TRUE(),
FALSE()
)
By default, this measure returns False:
But if we add a segmentation containing the list of countries and select one of them, the measure created will return the value True: