HASONEVALUE DAX Function (Information)
Returns true when there’s only one value in the specified column.
Syntax
| Parameter | Attributes | Description |
|---|---|---|
| ColumnName |
The column to check the filter info. |
Return values
TRUE when the context for ColumnName has been filtered down to one distinct value only. Otherwise is FALSE.
Remarks
HASONEVALUE corresponds to the following code:
COUNTROWS ( VALUES ( <ColumnName> ) ) = 1
» 2 related functions
Examples
-- HASONEVALUE checks that a column has only one value
-- visible in the current filter context
DEFINE
MEASURE Sales[Audio only] =
CALCULATE (
HASONEVALUE ( 'Product'[Category] ),
'Product'[Category] = "Audio"
)
MEASURE Sales[Audio and computers] =
CALCULATE (
HASONEVALUE ( 'Product'[Category] ),
'Product'[Category] IN { "Audio", "Computers" }
)
MEASURE Sales[Audio and bananas] =
CALCULATE (
HASONEVALUE ( 'Product'[Category] ),
'Product'[Category] IN { "Audio", "Bananas" }
)
EVALUATE
{
( "Audio only", [Audio only] ),
( "Audio and computers", [Audio and computers] ),
( "Audio and bananas", [Audio and bananas] )
}
| Value1 | Value2 |
|---|---|
| Audio only | true |
| Audio and computers | false |
| Audio and bananas | true |
Related articles
Learn more about HASONEVALUE in the following articles:
-
Using the SELECTEDVALUE function in DAX
This article describes how the SELECTEDVALUE DAX function simplifies the syntax required in many scenarios where you need to read a single value selected in the filter context. » Read more
-
Distinguishing HASONEVALUE from ISINSCOPE
This article describes the differences between HASONEVALUE and ISINSCOPE, which are two useful DAX functions to control the filters and the grouping that are active in a report. » Read more
-
Understanding Group By Columns in Power BI
This article describes how Power BI uses the Group By Columns attribute of a column and how you can leverage it in specific scenarios. » Read more
Related functions
Other related functions are:
Last update: Oct 22, 2025 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo
Microsoft documentation: https://docs.microsoft.com/en-us/dax/hasonevalue-function-dax
