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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.