Forum Discussion

savage63073's avatar
savage63073
Frequent Visitor
5 years ago
Solved

Count Values leveraging a unary relationship

Hi,   I am learning Power BI - hope this question is not too obvious.   I am trying to create a measure which counts values in a data set through a unary relationship.  It's an employee table whi...
  • Jihwan_Kim's avatar
    5 years ago

    Hi, savage63073 

    Please check the below picture and the measure.

     

     

     Number of Direct Reports From =
    VAR currentid =
    MAX ( Data[EmpID] )
    RETURN
    CALCULATE (
    COUNTROWS ( Data ),
    FILTER ( ALL ( Data ), Data[ManagerID] = currentid )
    ) + 0

     

     

    Hi, My name is Jihwan Kim.

     

    If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

     

    Linkedin: linkedin.com/in/jihwankim1975/

    Twitter: twitter.com/Jihwan_JHKIM