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
CastroRibeiro
Helper I
Helper I

Count values in tables that are related with condition

Table EQUIPMENT has the total equipment in stock and table EQUIPMENT_STATUS only records an occurrence with this equipment. I want to calculate a percentage of equipment that has status 1 and status 0

 

And for this, I need to count the total of equipment in the EQUIPMENT table that has status 1 in the EQUIPMENT_STATUS table

 

Any Ideias?

 

EQUIPMENT

EQUIPMENT_NAME
A
B
C

 

EQUIPMENT_STATUS

EQUIPMENT_NAMESTATUS
A1
B0
C1
1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @CastroRibeiro 

 

You can try the following methods.

Measure = 
Var _count=CALCULATE(COUNT(EQUIPMENT_STATUS[STATUS]),ALLEXCEPT(EQUIPMENT_STATUS,EQUIPMENT_STATUS[STATUS]))
Var _allcount=COUNTROWS(EQUIPMENT)
Return
DIVIDE(_count,_allcount)

vzhangti_0-1698742338910.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

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @CastroRibeiro 

 

You can try the following methods.

Measure = 
Var _count=CALCULATE(COUNT(EQUIPMENT_STATUS[STATUS]),ALLEXCEPT(EQUIPMENT_STATUS,EQUIPMENT_STATUS[STATUS]))
Var _allcount=COUNTROWS(EQUIPMENT)
Return
DIVIDE(_count,_allcount)

vzhangti_0-1698742338910.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.

 

vicky_
Super User
Super User

Is there any reason you need to have the EQUIPMENT table?
You should be able to get the count of status = 1 with the following DAX:

Equipment Status is 1 = COUNTROWS(FITER('EQUIPMENT_STATUS', [STATUS] = 1))

Helpful resources

Announcements
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.

Top Kudoed Authors