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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
lkay
Frequent Visitor

How to display 0 instead of blank when related record count is 0

Hello powerbi community, 

 

I'm trying to display a 0 value instead of blank, when record count from a related table does not give any values. 

 

Ex. Table 1 (Parent) has no related records in Table 2 (Child), so count is blank. But, id like to show 0's in a matrix table or visual. 

Ex. Adults (Table 1) who dont have kids (Table 2)

 

I tried creating a measure in Table 1 that says, but It didnt give me a proper result:

IF ( ISBLANK (CALCULATE ( COUNTROWS(RELATEDTABLE(Table2)))), 0 , CALCULATE ( COUNTROWS(RELATEDTABLE(Table2))

 

Any suggestions on what to do here?

 

Thank you

1 ACCEPTED SOLUTION
lkay
Frequent Visitor

The original formula worked with a column instead of a measure. Still learning the difference...

View solution in original post

4 REPLIES 4
lkay
Frequent Visitor

The original formula worked with a column instead of a measure. Still learning the difference...

lkay
Frequent Visitor

@VijayP thank you. I tried putting a +0, but it did not work. 

I tried:

IF ( ISBLANK (CALCULATE ( COUNTROWS(RELATEDTABLE(Table2)))), 0 , CALCULATE ( COUNTROWS(RELATEDTABLE(Table2)) +0

 

How can one show that ID #1 from Table 1 has 0 (NOT BLANK!) records from child Table 2. There must be a way.

 

I've been turning around in circles. 

 

Thanks,

VijayP
Super User
Super User

@lkay 

After entire formula just add  +0 , you will get required result




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


many thanks

Order Type ZMO1 (count) =
COUNTROWS(
    FILTER(
        WorkOrders,
        WorkOrders[ordertype] = "ZM01"
    )
)+0
// added +0 to return 0 instead of seeing "Blank"

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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