Forum Discussion

olimilo's avatar
olimilo
Icon for Post Prodigy rankPost Prodigy
1 year ago
Solved

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 period...
  • KarinSzilagyi's avatar
    1 year ago

    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 ) )