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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
kk_shp_user
Helper I
Helper I

Getting count per category in one column using data in another column

Edit: Simplified my example and description to make it easier to understand.

 

I have a data like below. The table contains employees and managers. Managers are also present as employee records.

kk_shp_user_0-1712575860405.png

 

I want to calculate the no. of emps per manager title. I am trying to populate the below table visual and am having a challenge in getting the highlighted value.

 

kk_shp_user_1-1712575917178.png

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @kk_shp_user 

Try using TREATAS 

Total_Emps_at_Title =
CALCULATE (
COUNTROWS ( 'Table' ),
TREATAS ( VALUES ( 'Table'[recruiter_title] ), 'Table'[emp_title] )
)

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

Hi @kk_shp_user 

Try using TREATAS 

Total_Emps_at_Title =
CALCULATE (
COUNTROWS ( 'Table' ),
TREATAS ( VALUES ( 'Table'[recruiter_title] ), 'Table'[emp_title] )
)

Thanks for yourt reply but the solution did not get the expected result.

@kk_shp_user 

Would be helpful if you present the results that you got. 

Apologies, its sensistive data hence posted an exmaple.

 

That said, than you so much. I got it to work using TREATAS() like you mentioned. I was using a measure inside the calculate and so had to add the ALLEXCEPT condition to remove ther filters affecting the measure and the TREATAS worked as expected.

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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