Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Match and Count

Hello, I searched for this in the forums, but I think I'm using the wrong terms and it's not a "match and count".  

I'd like to take the "Employee ID" data and count how many times it appears in the "Mgr_EmplID" column and return a total to a new column. In the example below "111" shows up twice under MGR_EMPLID, so the new column entry would show a "2".  I'm sure this has been answered before on the forums, but I can't find it, can someone point me in the right direction? Thank you!

 

EMPLOYEE IDMGR_EMPLID
111122
155111
122104
124111

 

  • Hi Anonymous ,

    You can use this measure:

    CountOfEmployeeId = 
    CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'), 'Table'[MGR_EMPLID] = SELECTEDVALUE('Table'[EMPLOYEE ID])))

     

    Proud to be a Super User.
    If I helped, please accept the solution and give kudos
    Linkedin

     

3 Replies

  • lkalawski's avatar
    lkalawski
    Resident Rockstar

    Hi Anonymous ,

    You can use this measure:

    CountOfEmployeeId = 
    CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'), 'Table'[MGR_EMPLID] = SELECTEDVALUE('Table'[EMPLOYEE ID])))

     

    Proud to be a Super User.
    If I helped, please accept the solution and give kudos
    Linkedin

     

  • smpa01's avatar
    smpa01
    Community Champion

    Anonymous  try this

    Column = CALCULATE(COUNTX('Table 1','Table 1'[MGR_EMPLID]),ALLEXCEPT('Table 1','Table 1'[MGR_EMPLID]))

    • Anonymous's avatar
      Anonymous
      Not applicable

      Perfect, thank you very much!