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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Record count default to 0 if Blank

I am working on a dashboard that returns a number of metrics

 

Each metric is some verison of "count of records" after applying filters

 

One of my metrics has no records (at the moment) that meet the requirements, so the count(ID) returns "BLANK".  I need it to return a value of 0

 

I searched these forums, found what looked like the solution, and created the below custom field ("Record Count") and am doing a SUM by this field.  But it still returns BLANK

 

RecordCount = IF(ISBLANK(**datasource**[ID]),0,1)

 

Is there a way in DAX to have the default value be 0 instead of BLANK when I return no records?

 

Thanks in advance for any help or feedback, I am grateful for this forum. 

4 REPLIES 4
SteveCampbell
Memorable Member
Memorable Member

You can try adding

 

+ 0

at the end of your measure.

 

Be aware, if you are using records that have been filtered out, then this will still show 0.

Be sure to use a STAR schema, and use DIMENSION tables as your filters and axis, not from the FACT table.

 

 

Appreciate your Kudos
I love to share about these - connect with me!

Stay up to date on  linkedin-logo.png
Read my blogs on  powerbi.tips_.png



Did I answer your question? Mark my post as a solution! Proud to be a Super User!


Connect with me!
Stay up to date on  
Read my blogs on  



Anonymous
Not applicable

Appreciate the suggestion but that did not work.  I still return a value of BLANK.

 

My custom calculated field now looks like the below, after your suggestion: 

ID Count = IF(ISBLANK(**datasource** [ID]),0,1) + 0

 

The metric is SUM of ID Count

 

The datasource I am using is a very complex SQL query joining a number of tables. It is not a "STAR schema with DIMENSION and FACT tables" setup.  

 

The output of this query has been validated by the relevant SMEs, so I am comfortable with the data source.  The filters being applied are what you would define as dimensions.

 

After applying these filters, the calculated field still returns 0 records

What visual are you using? Is it by chance a matrix with columns and rows?

 

It's a bit hard to say more without more information. If you could provide screenshot this may help.



Did I answer your question? Mark my post as a solution! Proud to be a Super User!


Connect with me!
Stay up to date on  
Read my blogs on  



hi, @Anonymous 

For your case, please create the dim metrics table and create the relationship with basic table.

and drag metrics filed from dim table in visual and add '+0' in the formula, then it should work well.

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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