Forum Discussion
Counting rows based on value on one column that is reference in another
- 4 years ago
If my above assumption is true you may try something like
Count = CALCULATE ( COUNTROWS ( TabeName ), TREATAS ( VALUES ( TabeName[Manager Name] ), TabeName[Employee Name] ), REMOVEFILTERS ( TabeName ) )you may try it with or without the REMOVEFILTERS part
I mean in a table visual place the manager name along with COUNTROWS measure
I think this does not work because the countrows will then only return one row for the row context provided (the one manager who is a member of one team). The problem is that the manager is not a member of their own team.
What you are suggesting is the first thing I tried but the data structure is more complex, I am afraid.
I need to be able to filter the table based on the current row context (the manager) but calculate the mapped team ID to that manager.
In the table I provided, if I look at Mike Manager, I need to filter the rows in which the team members are in Mike Manager's team, not the rows in which Mike has a managed team.
I hope this makes it a little clearer, and thank you for your help.
- tamerj14 years ago
Community Champion
"What you are suggesting is the first thing I tried but the data structure is more complex, I am afraid." What results did you get? What kind of structure that forces such complexity? As per this sample data CONTROWS should work just fine.
- AlexanderRbt4 years ago
Helper I
Hello,
you are correct. I can aggregrate by Manager Name (or Team ID). However, I need to aggregate by managed_team_id. So how many people fall under AA1, BB1, etc. My apologies for not being precise.
- tamerj14 years ago
Community Champion
I think you mean to say that the [ID of my team] column do not actually exist and you want to create it or directly create the count measure?