<b><br><font color=magenta><br>2 tables customer and customer activity<br>cstomer activity has <br>id, aty_typ, time<br>1 1 jul 10 13:00<br>1 1 july 10 14:00<br>1 3 july 11 12:00<br>1 3 july 11 15:00<br>1 4 july 14 15:00<br>assume aty_typ 1 is walking and 3 is jogging<br>and 4 is running<br>I am trying to create a formula for each customer i need to find the elapsed between the last time they jogged to them beginning to run. Some customers may not have begun jogging or could have gone straight to running.<br>I tried maximum(fld,condfld)<br>timevar x:=maximum(time,aty_typ=3) <br>it doesn't work. Hoe do i get a handle on max time if it exists for aty_typ 3 and then i can subtract that from the min time for aty_typ 4. Any help appreciated. thanks, Niku<br></font><br></b>