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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
OhLookAnError
Helper I
Helper I

How to return a zero when subtrahend is blank

I am trying to acurately display days since opened and days since closed in calculated columns. My days since closed column which is:  

 

Days Since Closed = tblAccounts[Todays Date] - tblAccounts[Account Closed]

 

is returning this 48888 when there is no closed date. 

 

How can I get this to return zero if the Account closed Column is blank? 

 

OhLookAnError_0-1669218964008.png

Thanks in advance! 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @OhLookAnError 
Please try

Days Since Closed =
tblAccounts[Todays Date]
    - COALESCE ( tblAccounts[Account Closed], tblAccounts[Todays Date] )

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @OhLookAnError 
Please try

Days Since Closed =
tblAccounts[Todays Date]
    - COALESCE ( tblAccounts[Account Closed], tblAccounts[Todays Date] )

Worked, Thank you! 

FreemanZ
Super User
Super User

try this:

 

Days Since Closed = 
VAR _duration =
tblAccounts[Todays Date] - tblAccounts[Account Closed]
RETURN
IF(
    [Account closed Column]=BLANK(),
    0,
   _duration 
)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors