Validating the date of the next record

I have a status table that's similar to this example and I'm wondering if it's possible to check whether the dates in each status are continuous for each customer.

Specifically, for a given customer, I'd like to check that the next record's Effective From date is exactly one day after the previous record's Effective To date.

Customer

Status

Effective From

Effective To

Adams

Renting

01/01/1996

03/01/2025

Adams

Void

04/01/2025

04/06/2025

Adams

Renting

05/06/2025

09/01/2026

Adams

Sold

10/01/2026

Bell

Renting

03/01/2026

Church

Renting

06/03/2002

01/09/2015

Church

Void

03/09/2015

12/01/2016

Church

Renting

13/01/2016

09/02/2026

Davies

Renting

10/05/2010

12/06/2026

Davies

Sold

13/06/2026

Is there a way to create a rule so that Adams, Bell and Davies would pass validation but Church would fail because the dates from Church renting to the void period are not continuous.

Tagged:

Answers

  • Jermolina, Katya
    Jermolina, Katya Administrator

    @Aimee Carter here is my solution to solving it. In a transform step, let's create two new columns. The first column is "Previous Effective To" which brings Effective To Date from a previous row into the next one. The second column "Continuous Date for Customer" then compares Effective From and Previous Effective To Dates and returns true if they are both present and the difference between them equal to one. We can then pass true/false values into the validation step to pass or fail the rule.

    image.png

    Here is the function for Previous Effective To date using Get Cell and previous row. We return both "previous row" Customer and Effective To Date and populate the value of the previous date if the customer matches between different rows. There is also some error handling added.

    image.png

    For Continuous Date check, we need to check if both "Effective From" and "Previous Effective To" dates are present and if they are, check the difference equals one day.

    image.png

    Attached the full solution as a dmx. Let me know if it works on a live data as expected.

  • @Jermolina, Katya This solution is fantastic and has worked with the real data, thank you for your help 😀