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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
JB_AT
Helper III
Helper III

Return 0 when blank

Hello


I would like to return 0 instead of blank().

I tried following the instructions here https://www.sqlbi.com/articles/how-to-return-0-instead-of-blank-in-dax/ and other variations, but the results seem to ignore any filters I have on the report and populates in data fields where it shouldn't.

I have a matrix visual with columns from the Date & Department dimensions. Which have a one to many relationship with the FACT table. The Fact Table collects lets say Deadline Data and if there is no date for a Deadline then there 

When I add any of the measures it shows 0 in all Dates  where the result is BLANK(), Ideally I only want to show 0 on the dates that appear only in the FACT table and not all dates from the Date table

Entries = 
IF (
    CALCULATE( 
        COUNT('FACTTable'[ID]),
        'FACTTable'[Valid Entry] = 1 ) = BLANK(),
        0, 
        CALCULATE( 
        COUNT('FACTTable'[ID]),
        'FACTTable'[Valid Entry] = 1 )
)

 Thanks in advance

2 ACCEPTED SOLUTIONS
BeaBF
Super User
Super User

@JB_AT Hi! Try with:

 

Entries =
VAR ValidEntries =
CALCULATE(
COUNT('FACTTable'[ID]),
'FACTTable'[Valid Entry] = 1
)
RETURN
IF(
ISBLANK(ValidEntries),
0,
ValidEntries
)

 

BBF

View solution in original post

Jihwan_Kim
Super User
Super User

Hi,

I tried to create a sample pbix file like below.

Please check [Entry measure fix:] measure in the below picture and the attached pbix file.

 

Jihwan_Kim_1-1737710322935.png

 

 

Jihwan_Kim_0-1737710303125.png

 

 

Entry measure fix: = 
VAR _periodstart =
    CALCULATE ( MIN ( 'fact'[date] ), REMOVEFILTERS ( 'calendar' ) )
VAR _periodend =
    CALCULATE ( MAX ( 'fact'[date] ), REMOVEFILTERS ( 'calendar' ) )
VAR _result =
    CALCULATE (
        COUNTROWS ( VALUES ( 'fact'[department_id] ) ),
        'fact'[valid_entry] = 1
    )
RETURN
    IF (
        MAX ( 'calendar'[Date] ) >= _periodstart
            && MIN ( 'calendar'[Date] ) <= _periodend,
        _result + 0
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

3 REPLIES 3
JB_AT
Helper III
Helper III

Thank you this worked 🙂

Jihwan_Kim
Super User
Super User

Hi,

I tried to create a sample pbix file like below.

Please check [Entry measure fix:] measure in the below picture and the attached pbix file.

 

Jihwan_Kim_1-1737710322935.png

 

 

Jihwan_Kim_0-1737710303125.png

 

 

Entry measure fix: = 
VAR _periodstart =
    CALCULATE ( MIN ( 'fact'[date] ), REMOVEFILTERS ( 'calendar' ) )
VAR _periodend =
    CALCULATE ( MAX ( 'fact'[date] ), REMOVEFILTERS ( 'calendar' ) )
VAR _result =
    CALCULATE (
        COUNTROWS ( VALUES ( 'fact'[department_id] ) ),
        'fact'[valid_entry] = 1
    )
RETURN
    IF (
        MAX ( 'calendar'[Date] ) >= _periodstart
            && MIN ( 'calendar'[Date] ) <= _periodend,
        _result + 0
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
BeaBF
Super User
Super User

@JB_AT Hi! Try with:

 

Entries =
VAR ValidEntries =
CALCULATE(
COUNT('FACTTable'[ID]),
'FACTTable'[Valid Entry] = 1
)
RETURN
IF(
ISBLANK(ValidEntries),
0,
ValidEntries
)

 

BBF

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.