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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
lastnn30
Post Patron
Post Patron

create measure to count male or female from gender column

Hi

I have gender field which has values like Male. Female. I want to create a measure called Male and then another one called Female and I want to count number of male and female.

 

I tired to write this measure 

 

Male = COUNTA(tdEmployee[Gender]);Filter(Male)
 
But I got error message. Thank you very much.SNAG-0548.jpg
2 ACCEPTED SOLUTIONS
ryan_mayu
Super User
Super User

@lastnn30 

pls try 

calculate(COUNTA(tdEmployee[Gender]), tdEmployee[Gender]="Male")





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

v-zhangti
Community Support
Community Support

Hi, @lastnn30 

 

You can also try the following methods.

Male = 
CALCULATE(COUNT(tdEmployee[Gender]),FILTER(ALL(tdEmployee),[Gender]="Male"))
Female = 
CALCULATE(COUNT(tdEmployee[Gender]),FILTER(ALL(tdEmployee),[Gender]="Female"))

vzhangti_0-1649144639360.png

 

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

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @lastnn30 

 

You can also try the following methods.

Male = 
CALCULATE(COUNT(tdEmployee[Gender]),FILTER(ALL(tdEmployee),[Gender]="Male"))
Female = 
CALCULATE(COUNT(tdEmployee[Gender]),FILTER(ALL(tdEmployee),[Gender]="Female"))

vzhangti_0-1649144639360.png

 

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.

ryan_mayu
Super User
Super User

@lastnn30 

pls try 

calculate(COUNTA(tdEmployee[Gender]), tdEmployee[Gender]="Male")





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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.

Top Solution Authors