Hi Deepak,
Once u have internal table with above data, u can sort the table based on VisitID and TourID. Then go for DELETE ADJACENT command to delete duplicate records. Finally u will have table with unique records and then u can update the keyfigure. This approach is helpful concerning performance tuning.
May help u.
Regards,
Avadhoot