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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
L-P
Frequent Visitor

Counta with conditions

Morning Guys, hope its all well!

I have a query where I need a Count of employee role id's. There is a column with the role id and another one with the role names.

I need to be able to do the count based on, for example.

 

When the measure Counts the total of role ids associated to a particular employee name 

 

Column Role Names 

 

Group Leader 

 

Member 

 

Business unit Leader

 

In some cases Business unit leader and group leader should considered as the same.

 

I'll appreciate if anyone has some feedback.

Have a great day 👍

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION
v-cazheng-msft
Community Support
Community Support

Hi @L-P,

 

If you would like to count role id for different role names, you may try this Measure.

Count on roles names = CALCULATE(COUNT('Table'[role id]),ALLEXCEPT('Table','Table'[role names]))

 

If you would like to count role id for one specific role name, you can try this Measure and make some changes per your needs.

Count for one role name = CALCULATE(COUNT('Table'[role id]),FILTER( ALL('Table'),'Table'[role names]="lisa"))

Sample data:

vcazhengmsft_0-1654752783627.png

 

The result:

vcazhengmsft_1-1654752783629.png

 

Also, attached the pbix file.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

View solution in original post

3 REPLIES 3
v-cazheng-msft
Community Support
Community Support

Hi @L-P,

 

If you would like to count role id for different role names, you may try this Measure.

Count on roles names = CALCULATE(COUNT('Table'[role id]),ALLEXCEPT('Table','Table'[role names]))

 

If you would like to count role id for one specific role name, you can try this Measure and make some changes per your needs.

Count for one role name = CALCULATE(COUNT('Table'[role id]),FILTER( ALL('Table'),'Table'[role names]="lisa"))

Sample data:

vcazhengmsft_0-1654752783627.png

 

The result:

vcazhengmsft_1-1654752783629.png

 

Also, attached the pbix file.

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

L-P
Frequent Visitor

Thanks, @Greg,

So far no luck!

 

 
Greg_Deckler
Community Champion
Community Champion

@L-P You can use the pattern COUNTAX(FILTER(...),...) or CALCULATE(COUNTA(...),...)

(1) CO-CU Excel to DAX Translation - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.