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
rogerdea
Helper IV
Helper IV

Retun 0 not blank when using variables

I am trying to ensure i return a 0 and not blank in this field.  I am unable to get it to work so far, my code is as follows.  any help greatly appreciated:

 

Weekly Target LB = 
        VAR Weeks =
            round(DATEDIFF(TODAY(),ENDOFYEAR('Date table'[Date],"31/01/2021"),DAY)/7,0)
        VAR OS = 
            COUNTROWS(FILTER('Metadata','Metadata'[Status] <> "RecordComplete"))
      
        RETURN
        OS / Weeks

 

1 ACCEPTED SOLUTION
themistoklis
Community Champion
Community Champion

@rogerdea 

 

Try any of the 3 options below:

 

1. Measure = CALCULATE ( SUM (table[column] ), FILTER (... ) ) + 0 (Add Zero at the end of the formula)

2. Measure = IF ( ISBLANK([Amount]), 0, [Amount])

3. Measure = IF (CALCULATE ( SUM ( Expenses[Actual] ) ) = BLANK (), 0, CALCULATE ( SUM ( Expenses[Actual] ) ) )

 

In your case try first the following:

RETURN
        (OS / Weeks) + 0

View solution in original post

1 REPLY 1
themistoklis
Community Champion
Community Champion

@rogerdea 

 

Try any of the 3 options below:

 

1. Measure = CALCULATE ( SUM (table[column] ), FILTER (... ) ) + 0 (Add Zero at the end of the formula)

2. Measure = IF ( ISBLANK([Amount]), 0, [Amount])

3. Measure = IF (CALCULATE ( SUM ( Expenses[Actual] ) ) = BLANK (), 0, CALCULATE ( SUM ( Expenses[Actual] ) ) )

 

In your case try first the following:

RETURN
        (OS / Weeks) + 0

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.