Forum Discussion

RandomUserPby's avatar
RandomUserPby
Regular Visitor
3 years ago

Count ID with only one element associated

Hello,
I have a table like this :

and I want to count IDs where I only have a pig associated with (so, in my example, ID 2 is an ID with only pig and nothing else)

I think its very easy to do in DAX but idk how to do it... 

Thanks you.

 

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    could you try this:

    PigCount = calculate(countrows('Table'),'Table'[Animal]="Pig" && count('Table'[ID])=1)
      • Anonymous's avatar
        Anonymous
        Not applicable

        Have you tried putting the dax formula on a calculated column?