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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Pricef1
Regular Visitor

How to count columns with numbers including 0, but don't count blank

I have been searching for over an hour and cant find the exact formula that will help. I am trying to calculate a total number of "trees" based on the information keyed into Sharepoint. Example of what I am using now: 

Total Trees Pulled = COUNT('SC87 Pet Treats Tear Down Trees'[Tree#1])*3
Pricef1_0-1686260300640.png

The concept was originally intended to have 3 "trees" per vat. We have updated our standards and now have to seperate the batches. So some may have 1,2,3 "trees" or have a 0 if there is no tag on particular tree, but need to count the 0 and not the blank. You will see from the information entered today total trees pulled is 21. In reality we have only pulled 17. I have also tried to divide it based on weight with each vat typically weighing around 300lbs. That didnt give me a true number either, but was closer to count. Any help would be greatly appreciated. 

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi, I am not sure how your datamodel looks like, but I tried to create a sample pbix file like below.

One of ways to solve this is to use == in the measure, instead of using only one = .

Jihwan_Kim_0-1686281162090.png

 

 

Item count version 2 (I want): = 
COUNTROWS (
    FILTER (
        VALUES ( Data[Item] ),
        NOT ( CALCULATE ( SUM ( Data[Value] ) ) == BLANK () )
    )
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


It doesnt like values and sum. 

Pricef1_0-1686282944498.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.