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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
olimilo
Post Prodigy
Post Prodigy

Measure showing value for periods without data

We're computing for the Defect Free % of our reports. Our data only goes as far as the current month but with the way the formula is structured (1 - (Reports with Defects / All Reports) ), the periods where there are no actual data pop up in our graph and show up as 100%:

 

olimilo_0-1755939469629.png

Is there a way I can get this to compute only for the periods where there is actual data? Oddly enough, a blank entry also appears:

 

olimilo_1-1755939524429.png

Whereas there shouldn't be any since I made the necessary filters for the page:

 

olimilo_2-1755939590114.png

 

QAIssues is a custom column computed like so:

QAIssues = 
    COUNTROWS(
        RELATEDTABLE('Defects')
    )

 

~Defect % = 
    VAR cntDefects =
        COUNTROWS(
            FILTER('Audits', AND(NOT(ISBLANK('Audits'[QAIssues])), 'Audits'[QAIssues] > 0))
        )
    
    RETURN (1 - DIVIDE(cntDefects, COUNTROWS('Audits')))

 

 

1 ACCEPTED SOLUTION
KarinSzilagyi
Solution Sage
Solution Sage

Your last bit after the return 

RETURN (1 - DIVIDE(cntDefects, COUNTROWS('Audits')))

is evaluated to 1-blank(), which PowerBI translates to 1-0 = 1 => 100% 

 

You can test this directly with

Minus Blank() = 1-BLANK()

which also returns 1.

 

If you want those entries to disappear from your visual, you’ll need to add a check before the subtraction and return BLANK() whenever the denominator is empty.

 

For example:

~Defect % =
VAR cntDefects =
    COUNTROWS (
        FILTER (
            'Audits',
            NOT ( ISBLANK ( 'Audits'[QAIssues] ) )
                && 'Audits'[QAIssues] > 0
        )
    )
VAR cntAll = COUNTROWS ( 'Audits' )
RETURN
    IF ( cntAll = 0, BLANK(), 1 - DIVIDE ( cntDefects, cntAll ) )

 

 



Did I answer your question? If so, please consider marking my response as the ‘Accepted Solution’ - it helps others with the same issue find the answer more easily!

View solution in original post

3 REPLIES 3
KarinSzilagyi
Solution Sage
Solution Sage

Your last bit after the return 

RETURN (1 - DIVIDE(cntDefects, COUNTROWS('Audits')))

is evaluated to 1-blank(), which PowerBI translates to 1-0 = 1 => 100% 

 

You can test this directly with

Minus Blank() = 1-BLANK()

which also returns 1.

 

If you want those entries to disappear from your visual, you’ll need to add a check before the subtraction and return BLANK() whenever the denominator is empty.

 

For example:

~Defect % =
VAR cntDefects =
    COUNTROWS (
        FILTER (
            'Audits',
            NOT ( ISBLANK ( 'Audits'[QAIssues] ) )
                && 'Audits'[QAIssues] > 0
        )
    )
VAR cntAll = COUNTROWS ( 'Audits' )
RETURN
    IF ( cntAll = 0, BLANK(), 1 - DIVIDE ( cntDefects, cntAll ) )

 

 



Did I answer your question? If so, please consider marking my response as the ‘Accepted Solution’ - it helps others with the same issue find the answer more easily!
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
rohit1991
Super User
Super User

Hi @olimilo 

Adjust your measure so it only calculates when there are audits:

Defect Free % =
VAR denom   = [Audits]
VAR defects = [Audits with Defects]
RETURN
   IF ( denom = 0, BLANK(), DIVIDE ( denom - defects, denom ) )

 

If you prefer to explicitly show 0% in months without audits, change it slightly:

Defect Free % (zero on no-audit) =
VAR denom   = [Audits]
VAR defects = [Audits with Defects]
RETURN
   IF ( denom = 0, 0, DIVIDE ( denom - defects, denom ) )

 

  • Use a proper Date table and relate it to your audit data.
  • Put Month from the Date table on the axis, set the X-axis to Continuous.
  • If you want to hide empty months altogether, add a visual filter [Audits] > 0.

 

image.png

 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.