OpenBI Docs Buy

HASONEFILTER

Whether a column is filtered directly to exactly one value.

Group: Information. Compatible with DAX.

Syntax

HASONEFILTER ( <columnName> )
ParameterTypeDescription
columnNameColumnThe column whose own filters are looked at.

Returns

Boolean. TRUE when the filters set on the column itself leave exactly one of its values.

Remarks

  • Only filters on this very column count: a slicer or a visual's grouping on it, a CALCULATE filter on it, or a filter over its whole table. A single value left over because some other column is filtered does not: HASONEVALUE is TRUE then, HASONEFILTER FALSE.
  • With no filter on the column it is FALSE, even when the column holds a single value.
  • When several filters on the column meet (one of them with KEEPFILTERS), it is the values they all keep that are counted.
  • It suits a measure that should react only to what the report reader picked for this column; to ask what the picked values are, use FILTERS.

Examples

One product left, but not picked

Cider is the only product of its category: the category's row leaves one product, yet nothing filters the product column itself.

EVALUATE
SUMMARIZECOLUMNS (
    ROLLUPADDISSUBTOTAL ( Products[Category], "Total" ),
    "Products", COUNTROWS ( VALUES ( Products[Product] ) ),
    "HASONEVALUE", HASONEVALUE ( Products[Product] ),
    "HASONEFILTER", HASONEFILTER ( Products[Product] )
)
ORDER BY [Total], Products[Category]
Products[Category]TotalProductsHASONEVALUEHASONEFILTER
BeerFALSE3FALSEFALSE
CiderFALSE1TRUEFALSE
(blank)TRUE4FALSEFALSE

Filters of CALCULATE

EVALUATE
ROW (
    "IPA", CALCULATE ( HASONEFILTER ( Products[Product] ), Products[Product] = "IPA" ),
    "IPA or Pils",
        CALCULATE (
            HASONEFILTER ( Products[Product] ),
            Products[Product] = "IPA" || Products[Product] = "Pils"
        ),
    "Category Cider", CALCULATE ( HASONEFILTER ( Products[Product] ), Products[Category] = "Cider" ),
    "No filter", HASONEFILTER ( Products[Product] )
)
IPAIPA or PilsCategory CiderNo filter
TRUEFALSEFALSEFALSE

HASONEVALUE, ISFILTERED, FILTERS, SELECTEDVALUE, ISCROSSFILTERED.

Last updated · OpenBI Studio 0.3.74