Forum Discussion

romovaro's avatar
romovaro
Responsive Resident
3 years ago
Solved

Starting date and End Date same field - Diff in Dates

Happy Friday   I have a question regarding difference in Days. I have the table below With CLient Name, Entity Number, Status and Date. THe column date is the Starting Date but also the End D...
  • Mikelytics's avatar
    Mikelytics
    3 years ago

    Hi romovaro 

    ah okay, thoight this is what you wanted to have. I created a second one. Please see below:

     

    Datediff2 = 
    
    var var_Client = [Client Name]
    var var_StartDate = [Date]
    var var_EndDate = 
       CALCULATE(
          MIN([Date]),
          FILTER(
             ALL('BPQ Status'),
             [Client Name] = var_Client &&
             [Date]>var_StartDate
          )
       )
    
    RETURN
    IF(
       NOT ISBLANK(var_EndDate),
       DATEDIFF(var_StartDate,var_EndDate,DAY)
    )

     

     

    better?

     

    romovaro  EDIT: I found an error in my screenshot with negative values in datediff2. THis was because my datecolumn was formatted as text. After I formatted it to date it worked fine. Please find below the updated screenshot after updating the data type of my date coliumn. Formula is still the same

     

     

    Best regards

    Michael

    -----------------------------------------------------

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your thumbs up!

    @ me in replies or I'll lose your thread.

    -----------------------------------------------------

    LinkedIn