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
cassidy
Power Participant
Power Participant

Count with Filter, not reacting to filter

Hello,

 

I have a list of products and the available inventory for each product on a specific day.  I simply want to count the product when the available inventory is > 0, but it returns the full count of products, no matter the qty.

 

I've done various forms of Counts, this is the current one:

 

In Stock Count = CALCULATE(COUNTX('Product Detail','Product Detail'[SKU]),Filter('Measures (Inventory BOW)',[Avail Status Units BOW (calc)] >0))
 
Small example of what it looks like.  It could be 500 units and Counts as 1 or 0 units and Counts as 1, the filter seems to have no impact.  The "Avail Status Units..." is a Measure that filters inventory to a specific date (beginning of the current week).:
Capture.JPG
1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @cassidy ,

 

 

Count Stock =
COUNTROWS (
FILTER ('Product Details',[Avail Status Units BOW (calc)] >0 )
)

 

Please share sample data if this does not work.

 

Regards,

HN

 

View solution in original post

3 REPLIES 3
stevedep
Memorable Member
Memorable Member

Use an IF statement?

InStockCount = 
var v_bow = CALCULATE(SUM('Table'[Avail Status BOW])) // your calculation
return
IF(v_bow>0;1;0)

 

harshnathani
Community Champion
Community Champion

Hi @cassidy ,

 

 

Count Stock =
COUNTROWS (
FILTER ('Product Details',[Avail Status Units BOW (calc)] >0 )
)

 

Please share sample data if this does not work.

 

Regards,

HN

 

@harshnathani , this seems to work!  Thanks

 

Are you able to easily explain why mine did not work?  I thought I was counting rows with the COUNTX.

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.