HASONEVALUE is a DAX function that returns TRUE when there is only one distinct value in a specified column.
Syntax
HASONEVALUE( ColumnName )
Argument | Properties | Description |
---|---|---|
ColumnName | The column to check the filter info. |
HASONEVALUE is a DAX function that returns TRUE when there is only one distinct value in a specified column.
HASONEVALUE( ColumnName )
Argument | Properties | Description |
---|---|---|
ColumnName | The column to check the filter info. |
TRUE
when the context for columnName
has been filtered down to one distinct value only. Otherwise is FALSE
.
An equivalent expression for HASONEVALUE() is COUNTROWS(VALUES(<columnName>)) = 1
.
This function is not supported for use in DirectQuery mode when used in calculated columns or row-level security (RLS) rules.
The following measure formula verifies if the context is being sliced by one value in order to estimate a percentage against a predefined scenario; in this case you want to compare Reseller Sales against sales in 2007, then you need to know if the context is filtered by single years. Also, if the comparison is meaningless you want to return BLANK.
= IF(HASONEVALUE(DateTime[CalendarYear]),SUM(ResellerSales_USD[SalesAmount_USD])/CALCULATE(SUM(ResellerSales_USD[SalesAmount_USD]),DateTime[CalendarYear]=2007),BLANK())
Other functions related to HASONEVALUE are:
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy