Forum Discussion

thomas_pike's avatar
thomas_pike
Frequent Visitor
4 years ago

Count of Filtered Counts

Good Evening,

 

I'm trying to write a DAX expression that counts the number of IDs that occur twice or more in a table.

 

For instance:

ID
A
B
C
A
B
A

 

...should return 2 as both A and B occur twice or more in the column.  Thanks for your assistance.

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hello

     

    Try this

    Countdoubleormore = countrows(filter(summarize('Table','Table'[id],"@nb",COUNTA('Table'[id])),[@nb]>1))

    measure

     

  • Hi,

     

    You can use this measure:

    Mesm=
    Var t = SUMMARIZE('Table','ID',"Cnt",CountRows('Table'))

    Return

     CountRows(FILTER(t,[Cnt] >=2))

     

     

    And, after creating the measure, you can use a card and drag ( or dispaly) the measure on the card, and you'll see the count you are looking for.

     

    Best regards. 

  • CNENFRNL's avatar
    CNENFRNL
    Icon for Community Champion rankCommunity Champion
    =
    COUNTROWS(
        FILTER( VALUES( DATA[ID] ), CALCULATE( COUNTROWS( DATA ) ) > 1 )
    )