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

Difference between two dates along with null value should be zero

Hi 

I created dax function for Difference between two dates along with null value i get the result difference but i can't get the null value as zero ,

My requirement is display the date difference along with Null value is zero but i didnt get zero it is get the value and minus value

Mahamood218_1-1643610510888.png

 

1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community Champion

HI @Anonymous ,

 

Update your code like below:-

IF (
    ISBLANK ( 'sales dataset'[Sch.ship.date2] ),
    0,
    DATEDIFF ( 'sales dataset'[promise date], 'sales dataset'[sch.ship.date2], DAY )
)

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

3 REPLIES 3
Samarth_18
Community Champion
Community Champion

HI @Anonymous ,

 

Update your code like below:-

IF (
    ISBLANK ( 'sales dataset'[Sch.ship.date2] ),
    0,
    DATEDIFF ( 'sales dataset'[promise date], 'sales dataset'[sch.ship.date2], DAY )
)

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Anonymous
Not applicable

Hi Samarth,

i applied the above code now it is working thanks for support

Mahamood218_0-1643624947562.png

 

Thats Great @Anonymous , Please mark my solution as answer so that it will help others to find answer quickly.

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

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.