Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

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

 

  • 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

3 Replies

  • Samarth_18's avatar
    Samarth_18
    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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Samarth,

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

       

      • Samarth_18's avatar
        Samarth_18
        Community Champion

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