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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Scott_Visio
Frequent Visitor

count values in a table and include zero when ID doesn't exist

Seems like this ought to be simple and I've found solutions to similar sounding problems but can't make the right connection.

 

I have two tables represented by the simple examples below. The first table contains a list of unique IDs; the second contains values for some IDs and will be filtered by department.

Scott_Visio_3-1640275057380.png

 

I need a measure that counts the number of text values that exist for each ID in the second table. That part is easy using COUNTA().  The part I'm struggling with is how to produce a result that includes zero counts for IDs that don't exist in the second table. What I want is this

Scott_Visio_1-1640274761956.png

but what I'm getting is this

Scott_Visio_2-1640274937633.png

 

Thanks

1 ACCEPTED SOLUTION
bcdobbs
Community Champion
Community Champion

Try adding a +0 to your exisitng COUNTA measure.

 

It will turn a blank into a 0. Alternatively if you click the down arrow for ID in the visual you can click Show Items with no data (won't get zero's jut blanks):

bcdobbs_0-1640276533760.png

 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

View solution in original post

5 REPLIES 5
Scott_Visio
Frequent Visitor

Thanks to both @bcdobbs and @dudeyates. Turns out that I had an unrelated date/time issue in my real data (can't share that data here) and that error obscured the benefits of adding+0 to my measure. Now that I've fixed the underlying data issue, adding +0 allows me to include zero values in the result.

bcdobbs
Community Champion
Community Champion

Try adding a +0 to your exisitng COUNTA measure.

 

It will turn a blank into a 0. Alternatively if you click the down arrow for ID in the visual you can click Show Items with no data (won't get zero's jut blanks):

bcdobbs_0-1640276533760.png

 



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

I've tried +0 and there's no change but that could be the result of other formula elements in the real measure. The visual I'm using doesn't include a show items with no data.

 

Let me go back to the real data and see whether I can figure out something else.

Do you want to send the full DAX of your measure over?

 

Also what visual are you using?



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Hello @Scott_Visio 

 

I agree with bcdobbs. It also might be you're pulling the department table ID instead of the ID from the ID table into the visual? I'd made that mistake when duplicating your data 🙂


Once I pulled the right ID column I got the correct results 

dudeyates_0-1640284016604.png

 

dudeyates_1-1640284105070.png

 

Hope that helps!
James

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors