Forum Discussion

shoemaker27's avatar
shoemaker27
Frequent Visitor
3 years ago
Solved

Count Distinct Measure at lowest level

Hi!, Im struggling with this measure, Im not getting the result I want, I have this table: sale_id sale_type person 1 1 a 2 1 b 3 2 c 4 2 x 5 2 y 6 2 z 7 3 a ...
  • tamerj1's avatar
    3 years ago

    Hi shoemaker27 
    Pleas try

    Distinct_Person_Per_Sale_Type =
    COUNTROWS (
        CALCULATETABLE (
            VALUES ( 'Table'[person] ),
            ALL ( 'Table' ),
            -- can use ALLEXCEPT and include filter safe columns if any
            VALUES ( 'Table'[sale_type] )
        )
    )
  • tamerj1's avatar
    tamerj1
    3 years ago

    shoemaker27 

    Please try

    Distinct_Person_Per_Sale_Type =
    COUNTROWS (
    CALCULATETABLE (
    VALUES ( 'Table'[person] ),
    ALLSELECTED ( 'Table' ),
    VALUES ( 'Table'[sale_type] )
    )
    )