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
Anonymous
Not applicable

Show Blank Date Value with DAX Formula

Hi there, 

 

I've used this forum a great deal and got an awesome DAX formula to calculate Net Working Days (see below). It works great when I have both a "Created Date" and "First CC Update" value. But when the "First CC Update" is blank, the formula doesn't work... I would hope that the formula can just return a Blank value instead. How can I modify my current DAX formula?

So the end result I'm looking for is:

 

Lead 1     Tuesday, January 1, 2019             Friday, March 15, 2019          54 days 0 hours 0 minutes
Lead 2     Wednesday, January 2, 2019

Lead 3     Wednesday, February 6, 2019     Sunday, February 16, 2019     8 days 0 hours 0 minutes

 

Capture.PNGCapture2.PNG

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous  - 

1. Select your visual

2. Right-click the date column and click "Show Items with no data".

Show Items With No Data.PNG

 

Hope this helps,

Nathan

View solution in original post

12 REPLIES 12
Anonymous
Not applicable

@Anonymous  -

To check whether a value is blank, you can use the following pattern:

 IF(
    ISBLANK(<Value to Check>), 
    BLANK(),
    <Go get your value! 🙂 >
)

 

In this particular case, beginning with the RETURN line:

RETURN

 IF(
    ISBLANK(Calendar2), 
    BLANK(),
    COUNTX........
)

Anonymous
Not applicable

@Anonymous I'm getting this error below?

Capture3.PNG

Anonymous
Not applicable

@Anonymous  - Oops! I didn't notice Calendar2 was a table variable. You can substitute

ISBLANK(Calendar2) 

with 

ISBLANK(MAX(HD[First CC Update]))

Anonymous
Not applicable

Ahh 😞 So the formula works, but Power BI still doesn't like the "Blank" First CC Update value. So therefore, won't show it. See below.Capture4.PNGCapture5.PNG

Anonymous
Not applicable

@Anonymous  - You could do the IF(ISBLANK check at the very beginning of the measure. If it's blank, don't do anything else.

Anonymous
Not applicable

Where would I put the IF(ISBLANK check exactly? Before the Variables...?

 

Also, if it doesn't do anything else, would it still bring in the NetDays for the columns that have both dates...?

Anonymous
Not applicable

Yes, before the variables.

 

Yes, it would bring back a value, because this is calculated individually for each cell.

 

Anonymous
Not applicable

@Anonymous 

Will it help if I try to attach the file?

 

I've also pasted the formula below. Not quite sure where to put the ISBLANK as it's throwing an error.

 

__NetWorkDaysHoursMinutes =
VAR Calendar1 = CALENDAR(MAX(HD[Created Date]),MAX(HD[First CC Update]))
VAR Calendar2 = ADDCOLUMNS(Calendar1,"WeekDay",WEEKDAY([Date],2))
RETURN
IF(ISBLANK(MAX(HD[First CC Update])), BLANK(), COUNTX(FILTER(Calendar2,[WeekDay]<6),[Date]) & " Days " &
HOUR(MOD(MAX(HD[First CC Update]) - MAX(HD[Created Date]),1)) & " Hours " &
MINUTE(MOD(MAX(HD[First CC Update]) - MAX(HD[Created Date]),1)) & " Minutes"
Anonymous
Not applicable

@Anonymous  - 

Did you try it like this? :

 

__NetWorkDaysHoursMinutes =
IF(
	ISBLANK(MAX(HD[First CC Update])), 
	BLANK(),
	VAR Calendar1 = CALENDAR(MAX(HD[Created Date]),MAX(HD[First CC Update]))
	VAR Calendar2 = ADDCOLUMNS(Calendar1,"WeekDay",WEEKDAY([Date],2))
	RETURN
	 	COUNTX(FILTER(Calendar2,[WeekDay]<6),[Date]) & " Days " &
		HOUR(MOD(MAX(HD[First CC Update]) - MAX(HD[Created Date]),1)) & " Hours " &
		MINUTE(MOD(MAX(HD[First CC Update]) - MAX(HD[Created Date]),1)) & " Minutes"
)
Anonymous
Not applicable

@Anonymous The formula works but it still gives me the below (see screenshot). It eliminates "Lead 2" row.Capture.PNG

Anonymous
Not applicable

@Anonymous  - 

1. Select your visual

2. Right-click the date column and click "Show Items with no data".

Show Items With No Data.PNG

 

Hope this helps,

Nathan

Anonymous
Not applicable

You are freakin awesome @Anonymous. SUCH A LIFESAVER! THANK YOU VERY MUCH!!!!!

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.

Top Solution Authors