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
jgulliver
Frequent Visitor

Display the result of the difference between 2 dates (in days) as 0 when 1 of the dates is blank

Hi,

 

Being a newbie to this, I was wondering if this would be possible at all.

 

I am working on relatively unclean data (have yet to advice the business to enforce a data cleansing project) as I wanted to demonstrate via a PowerBI dashboard that you get meaningless/rubbish insights if you don't have clean/meaningful data behind it.

 

I am working on showing the business how long it takes for a deal to go through each sales milestone, i.e., from when an offer was accepted to when a deposit was received. There are a number of entries in the table where I have the Offer Date but with no Accepted date, however, the result that I am being given is in the negative and not sure how this is calculated behind the scenes.

 

So for the formula, I have used Column = INT ([AcceptedDate] - [ReceivedDate]), where the ReceivedDate is 18 Aug 2022 and the AcceptedDate is blank. The result I get is -44791. Two questions please:

1. How did the system calculate this to get a result when there is a missing date?

2. In this scenario, is possible to just show the result as 0?

 

I would like to add that because of the negative numbers the tiles I have used on the dashboard I cannot accurately display a tile that shows the Ave. No. of Days from Offer to Deposit.

 

Any help that anyone can provide will be greatly appreciated.

 

 

Thanks!!!!

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @jgulliver 

To show 0 in such case is a good idea. Try like:

 

Column = 
IF(
    [AcceptedDate]=BLANK(),
    0,
    INT ([AcceptedDate] - [ReceivedDate])
)

 

View solution in original post

2 REPLIES 2
jgulliver
Frequent Visitor

Thank you! 

FreemanZ
Super User
Super User

hi @jgulliver 

To show 0 in such case is a good idea. Try like:

 

Column = 
IF(
    [AcceptedDate]=BLANK(),
    0,
    INT ([AcceptedDate] - [ReceivedDate])
)

 

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.