Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Dynamic Count of Rows

Hi PBI Community,   I'm wondering whether you could help me with a problem I came across recently. I do have a lengthy DAX measure to correctly calculate a metric at different hierarchy levels and ...
  • parry2k's avatar
    7 years ago

    Anonymous try this measure, change table and column name as per your data model.

     

    Count of Products = 
    VAR __currentProduct = SELECTEDVALUE( Table3[Product] ) 
    RETURN 
    CALCULATE( 
        COUNTROWS( Table3 ),  
        ALLSELECTED( Table3 ), 
        Table3[Product] = __currentProduct 
    )