Forum Discussion

RvdHeijden's avatar
RvdHeijden
Post Prodigy
9 years ago

DateDiff with a BLANK value

I have a question about a 'simple' datediff formula.

 

Ive got 2 date values and i need to know the difference between them. At first this is a simple question if both colums have values.

But sometimes the second column hasn't got a value yet.

 

So i need to change this formula so that WHEN 'Klachten [Gefiatteerd]  ISBLANK it uses TODAY for a date.

Does anyone know how i can do that ?

 

Doorlooptijd = SWITCH ( TRUE ();
    Klachten[binnengekomen] < Klachten[gefiatteerd]; DATEDIFF ( Klachten[binnengekomen]; Klachten[gefiatteerd]; DAY );
    Klachten[gefiatteerd] > Klachten[binnengekomen]; DATEDIFF ( Klachten[gefiatteerd]; Klachten[binnengekomen]; DAY ) * -1; 0 )

19 Replies

  • vanessafvg's avatar
    vanessafvg
    Community Champion

    RvdHeijden or you could say

     

    test column =
    IF ( startdate < enddate, DATEDIFF ( startdate, enddate, DAY ), BLANK () )

     

    or

     

    test column =
    IF ( ISBLANK ( enddate ), BLANK (), DATEDIFF ( startdate, enddate, DAY ) )

    • RvdHeijden's avatar
      RvdHeijden
      Post Prodigy

      vanessafvg

      if i understand your formula it doesn't return a value if the enddate is BLANK right ?

      My question was that IF the enddate is BLANK it should use TODAY to fill in the blank Enddate

      • vanessafvg's avatar
        vanessafvg
        Community Champion

        RvdHeijden

         

        test =
        IF (
            ISBLANK ( enddate ),
            DATEDIFF ( startdate, TODAY ()DAY ),
            DATEDIFF ( startdate, enddate, DAY )
        )

         

        yep sorry missed that