HASONEVALUE DAX Function in Power BI
The HASONEVALUE function checks whether a specified column has exactly one distinct value in the current filter context. It returns TRUE if the column has only one value and FALSE otherwise. This function is particularly useful in measures to control logic based on the presence of a single value.
DAX Syntax HASONEVALUE(columnName)
The parameter columnName is the name of an existing column, using standard DAX syntax. It cannot be an expression.
Note: An equivalent expression for HASONEVALUE() is COUNTROWS(VALUES(columnName)) = 1.
Example: Let’s we have following table named “CustomersData”.

Let’s create a new measure with name “HASONEVALUE Measure”.
DAX
The output of the above dax code is shown below:

When we have selected the Haryana state from the slicer, we found the table is filtered down to one distinct value in the State Status column. So, the measure returns True.
