Use Col Min() and Date Difference. If you really need the first observation to be missing value, you can add if statement to check for it
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(6),
Compress File When Saved(1),
New Column("ID",
Character,
"Nominal",
Set Values({"ABC123", "ABC123", "ABC123", "EFG567", "EFG567", "XYZ901"})
),
New Column("DATE",
Numeric,
"Continuous",
Format("m/d/y", 12),
Input Format("m/d/y"),
Set Values([3692304000, 3718483200, 3770928000, 3707856000, 3718483200, 3705264000])
),
New Column("ELAPSED_DAYS",
Numeric,
"Continuous",
Format("Best", 12),
Set Values([., 303, 607, ., 123, .])
)
);
dt << New Column("elapseddays", continuous, numeric, Formula(
Date Difference(Col Min(:Date, :ID), :Date, "day"))
);
-Jarmo