Forum Discussion

Cactus26's avatar
Cactus26
Helper I
8 years ago
Solved

Count unique values

Hi,   I am struggling with creation of the measure which will be recalculated after the filters in report via slicers will be selected. I was able to get the same effect using calculated columns, ...
  • AlbertoFerrari's avatar
    8 years ago

    Hi,

     

    Something like this should work (did not test it, writing it blind)

    COUNTROWS ( 
        FILTER ( 
            VALUES ( Table[YourColumn] ),
            CALCULATE ( COUNTROWS ( Table ) = 1
         )
    )
    
    and 
    
    COUNTROWS ( 
        FILTER ( 
            VALUES ( Table[YourColumn] ),
            CALCULATE ( COUNTROWS ( Table ) >= 3
         )
    )


    Of course, by playing with the condition of FILTER, you can achievev different results. 


    Have fun with DAX!

    Alberto Ferrari
    http://www.sqlbi.com