Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
eyysee
Regular Visitor

Count how many values exist in one column in relation to another

Hey all!

 

I've been struggling to create the right query for a new column to calculate how many values exist in one column in relation to another. I'll try my best to explain the problem I'm having.

 

PersonManagerNumber of Managees
JohnDavid2
JeffBill2
JulesSam1
JakeDavid2
JamesBill2

 

The "Person" column is uniqie and all names are different and each Person has a manager. A Manager may have more than one person to manage and I'd like to display this in the "Number of Managees" column so I can then filter by each unique manage and count how many managee's they have each.

 

Can you help me curate the DAX formula in the "Number of Managees" colum that would give me the desired result?

I'm open to suggesstions on how this may be better represented... a new table with a relationship maybe?

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @eyysee 

 

You can try the following methods.

Column:

Count = 
CALCULATE ( COUNT ( 'Table'[Manager] ),
    ALLEXCEPT ( 'Table', 'Table'[Manager] )
)

vzhangti_0-1674093322533.png

Measure = CALCULATE ( COUNT ( 'Table'[Manager] ),
    ALLEXCEPT ( 'Table', 'Table'[Manager] )
)

vzhangti_1-1674093491210.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

This calculated column works

Number of managers = calculate(countrows(Data),filter(Data,Data[Manager]=earlier(Data[Manager])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-zhangti
Community Support
Community Support

Hi, @eyysee 

 

You can try the following methods.

Column:

Count = 
CALCULATE ( COUNT ( 'Table'[Manager] ),
    ALLEXCEPT ( 'Table', 'Table'[Manager] )
)

vzhangti_0-1674093322533.png

Measure = CALCULATE ( COUNT ( 'Table'[Manager] ),
    ALLEXCEPT ( 'Table', 'Table'[Manager] )
)

vzhangti_1-1674093491210.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

piotr_gor
Helper II
Helper II

I've used your sample data. It just simply COUNTROWS. 
Filter context will do job for you. 

piotr_gor_0-1674032406484.png

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Top Solution Authors