Forum Discussion

L-P's avatar
L-P
Frequent Visitor
4 years ago
Solved

Counta with conditions

Morning Guys, hope its all well! I have a query where I need a Count of employee role id's. There is a column with the role id and another one with the role names. I need to be able to do the count...
  • v-cazheng-msft's avatar
    4 years ago

    Hi L-P,

     

    If you would like to count role id for different role names, you may try this Measure.

    Count on roles names = CALCULATE(COUNT('Table'[role id]),ALLEXCEPT('Table','Table'[role names]))

     

    If you would like to count role id for one specific role name, you can try this Measure and make some changes per your needs.

    Count for one role name = CALCULATE(COUNT('Table'[role id]),FILTER( ALL('Table'),'Table'[role names]="lisa"))
    
    

    Sample data:

     

    The result:

     

    Also, attached the pbix file.

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

     

    Best Regards,

    Community Support Team _ Caiyun