HASONEFILTER

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.

Syntax

HASONEFILTER(
    column
)

Parameters
  • column: Name of an existing column. It cannot be a DAX expression.
Returned value

The HASONEFILTER function returns a Boolean.

Additional Information

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.

Examples

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:

HASONEFILTER function. Example of use

But if we add a segmentation containing the list of countries and select one of them, the measure created will return the value True:

HASONEFILTER function. Example of use
Category
Filter
Submitted by admin on Tue, 01/15/2019 - 19:17