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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
common763
Helper III
Helper III

Date Calculation is blank if one of the dates blank

I am getting a "Expressions that yeild variant data-type cannot be used to define calculated columns" error" if I change the 0 to "".  I know this is simple but need help.  I have the below calculated column.  

 

Days btw dates = if(ISBLANK(DATE1,0, if(ISBLANK(DATE2),0,NETWORKDAYS(DATE1,DATE2)))
 
Right now it is displaying 0 if the DATE1 or DATE2 is blank.  I want it to display "" or nothing if one or both of the dates are missing.  Can someone help me tweak this calculated column to do so if one of the dates or both are blank?  
1 ACCEPTED SOLUTION
Dangar332
Super User
Super User

Hi, @common763 


Try below measure

 

 Days btw dates=
if(
ISBLANK(DATE1),
0,
if(
ISBLANK(DATE2),
0,
NETWORKDAYS(DATE1,DATE2)))


OR 

Days btw dates =
 if(
   ISBLANK(DATE1),
   "",
   if(
     ISBLANK(DATE2),
     "",
     convert( NETWORKDAYS(DATE1,DATE2),STRING)
   )
 )

 

View solution in original post

3 REPLIES 3
common763
Helper III
Helper III

My head wasnt working yesterday...all i had to do was this below...I was putting "" instead of Blank()

 

Days btw dates = if(ISBLANK(DATE1,0if(ISBLANK(DATE2),0,NETWORKDAYS(DATE1,DATE2)))

to

Days btw dates = if(ISBLANK(DATE1,BLANK(), if(ISBLANK(DATE2),BLANK(),NETWORKDAYS(DATE1,DATE2)))

common763
Helper III
Helper III

thanks.  this works.  Appreciate it. 

Dangar332
Super User
Super User

Hi, @common763 


Try below measure

 

 Days btw dates=
if(
ISBLANK(DATE1),
0,
if(
ISBLANK(DATE2),
0,
NETWORKDAYS(DATE1,DATE2)))


OR 

Days btw dates =
 if(
   ISBLANK(DATE1),
   "",
   if(
     ISBLANK(DATE2),
     "",
     convert( NETWORKDAYS(DATE1,DATE2),STRING)
   )
 )

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.